inject stratvars

This commit is contained in:
David Brazda
2023-04-14 12:06:37 +02:00
parent a1aa1c3f75
commit 8f7ca4a8b2
16 changed files with 144 additions and 57 deletions

View File

@@ -4,31 +4,29 @@ print(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from alpaca.data.historical import CryptoHistoricalDataClient, StockHistoricalDataClient
from alpaca.data.requests import CryptoLatestTradeRequest, StockLatestTradeRequest, StockLatestBarRequest, StockTradesRequest
from alpaca.data.enums import DataFeed
from config import API_KEY, SECRET_KEY, MAX_BATCH_SIZE
from v2realbot.config import ACCOUNT1_PAPER_API_KEY, ACCOUNT1_PAPER_SECRET_KEY
from v2realbot.utils.utils import zoneNY
from datetime import datetime, timezone, time, timedelta, date
import pytz
from rich import print
#práce s datumy
zone_NY = pytz.timezone('America/New_York')
parametry = {}
symbol = ["BAC"]
client = StockHistoricalDataClient(API_KEY, SECRET_KEY, raw_data=True)
datetime_object_from = datetime(2023, 3, 16, 9, 30, 0, tzinfo=zone_NY)
datetime_object_to = datetime(2023, 3, 16, 16, 00, 0, tzinfo=zone_NY)
client = StockHistoricalDataClient(ACCOUNT1_PAPER_API_KEY, ACCOUNT1_PAPER_SECRET_KEY, raw_data=True)
datetime_object_from = datetime(2023, 4, 12, 15, 45, 8, tzinfo=zoneNY)
datetime_object_to = datetime(2023, 4, 12, 15, 45, 10, tzinfo=zoneNY)
trades_request = StockTradesRequest(symbol_or_symbols=symbol, feed = DataFeed.SIP, start=datetime_object_from, end=datetime_object_to)
all_trades = client.get_stock_trades(trades_request)
#print(all_trades)
print(all_trades)
print(len(all_trades['BAC']))
# print(len(all_trades['BAC']))
# print(all_trades['BAC'])
# for i in all_trades:
# print(all_trades[i])
if __name__ == "__main__":
# bar will be invoked if this module is being run directly, but not via import!
print("hello")
# if __name__ == "__main__":
# # bar will be invoked if this module is being run directly, but not via import!
# print("hello")