forked from pst-group/pysystemtrade
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrepocsv_multiple_prices.py
More file actions
executable file
·30 lines (22 loc) · 998 Bytes
/
repocsv_multiple_prices.py
File metadata and controls
executable file
·30 lines (22 loc) · 998 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""
Copy from csv repo files to db for multiple prices
"""
from sysdata.csv.csv_multiple_prices import csvFuturesMultiplePricesData
from sysproduction.data.prices import diagPrices
if __name__ == "__main__":
input("Will overwrite existing prices are you sure?! CTL-C to abort")
diag_prices = diagPrices()
db_multiple_prices = diag_prices.db_futures_multiple_prices_data
csv_multiple_prices = csvFuturesMultiplePricesData()
instrument_code = input("Instrument code? <return for ALL instruments> ")
if instrument_code == "":
instrument_list = csv_multiple_prices.get_list_of_instruments()
else:
instrument_list = [instrument_code]
for instrument_code in instrument_list:
print(instrument_code)
multiple_prices = csv_multiple_prices.get_multiple_prices(instrument_code)
print(multiple_prices)
db_multiple_prices.add_multiple_prices(
instrument_code, multiple_prices, ignore_duplication=True
)