ServerPortfolio  2.0
Python parsers and server
 All Classes Namespaces Files Functions Variables Properties Pages
GlobalDicts.py
Go to the documentation of this file.
1 ## @package serverportfolio.GlobalDicts
2 # @brief Global variables for configuration: paths, TCP ports and generic definitions.
3 #
4 # Paths, class EAction, test mode, PORT of servers,\n
5 # OpeningMarket, DictMarketMySQLtoDictStock
6 #
7 # Last Changed $Id: GlobalDicts.py 27 2015-04-25 16:16:47Z michael $
8 
9 from enum import Enum
10 
11 ## will load data in data_test and write in data_test/historical_tmp
12 # internally set PATH_DATA to test in all C++ functions
13 TEST_MODE = True #False
14 
15 # new, for unit-test stock_wrapper
16 # to save InstValue, use same directory than used by C++. need to clean files.
17 # contains XML files for each stock in data/xml
18 # all done by C++
19 PATH_DATA_ROOT="/home/michael/workspace_kepler/ROOT_application/data"
20 # In case of TEST_MODE or uint-test
21 PATH_DATA_ROOT_TEST="/home/michael/workspace_kepler/ROOT_application/data_test"
22 
23 ## global path to the data directory.
24 PATH_DICT="/home/michael/workspace_kepler/ServerPortfolio/trunk/ServerPortfolio/data"
25 PATH_DICT_TEST="/home/michael/workspace_kepler/ServerPortfolio/trunk/ServerPortfolio/data_unittest"
26 
27 ## @brief Default name for the configuration file of the stocks.
28 # The file is searched in the PATH_DICT directory
29 DEFAULT_DICTIONARY="dictstocks.txt"
30 
31 ## @briename for server
32 HOST = "localhost"
33 ## port to which the server listens.
34 PORT = 9999
35 ## port of the GUI server.
36 PORT_GUI = 9998
37 
38 ## Additional global dictionary.
39 # used by AutoParser, could extend week-end....
40 OpeningMarket={'europe' :['9h00mn', '17h35mn'],
41  'us' :['15h30mn','22h00mn'], # CORRECT
42  #'us' :['16h00mn','22h00mn'], #WRONG, for TEST
43  'mp' :['0h00mn' ,'0h00mn'], ##have to check gold, euro/dollar...
44  'devise' :['0h00mn' ,'0h00mn'], ##week-end ??
45  'ml_euro' :['15h00mn']
46  }
47 
48 ## used for MySQL correspondance.
49 DictMarketMySQLtoDictStock={'europe' :['FR','DE'],
50  'us' :['US'],
51  'ml_euro':['ML_FR'],
52  'mp' :['MP'],
53  'devise' :['DEVISE']
54  }
55 
56 # to check why it is needed
57 ## @brief Translate market MySQL to market DictStock, used for Opening market
58 # @param marketMySQL :
59 def MarketMySQL_to_DictStock(marketMySQL):
60 
61  for k,v in DictMarketMySQLtoDictStock.iteritems():
62  if marketMySQL in v:
63  return k
64  #should not arrive here
65  assert 1==1, 'Problem of definition of Market MySQL to DictStock'
66 
67 # Many ways to define enumerations in python, need enum34 module with python 2.7
68 # http://stackoverflow.com/questions/36932/how-can-i-represent-an-enum-in-python
69 ## @class EAction
70 # @brief Enumeration for the action to be performed by the parser.
71 #
72 # Possible values:
73 # - \c InstValue : instantaneous value of the asset.
74 # - \c HistPrice : historical price, daily range.
75 # - \c DatesIntro : first historical value available from Yahoo.
76 # - \c DivSplit : dividends and shares split.
77 # - \c Fundamental : fundamental data (PER,BookValue,..).
78 # - \c Info : name of the company, industry and sector given by Yahoo.
79 # - \c Static : data contained in the configuration file dictstocks.txt
80 # - \c NoAction : only for tests (may be deleted later)
81 #
82 class EAction(Enum):
83  # Test, initialise UpdateStock object without any parser associated. It is unknown or may change
84  # or it is not needed (SockeServer)
85  #
86  # Noaction usefull only for UpdateStocks, but pollutes the other function.
87  # But may be useful if we implement also AllAction (Static apart)
88  NoAction = 0,
89  HistPrice = 1,
90  DatesIntro = 2,
91  DivSplit = 3,
92  InstValue = 4,
93  Fundamental = 5,
94  Static = 6,
95  Info = 7,
96  # not related to a parser action, apart, derived ??
97  # ValidXML = 8
Enumeration for the action to be performed by the parser.
Definition: GlobalDicts.py:82
def MarketMySQL_to_DictStock
Translate market MySQL to market DictStock, used for Opening market.
Definition: GlobalDicts.py:59