Skip to content

Commit

Permalink
+ LIVE trading + отправка заявок
Browse files Browse the repository at this point in the history
  • Loading branch information
WISEPLAT committed Nov 14, 2022
1 parent 7aa89f9 commit 99c9e58
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 5 deletions.
12 changes: 7 additions & 5 deletions main_live_test2.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ def OnTransReply(self, data):
print('OnTransReply')
print(data['data']) # Печатаем полученные данные
print(type(data['data']))
_transaction_id = data['data']['order_num']
print(_transaction_id)

def OnOrder(self, data):
"""Обработчик события получения новой / изменения существующей заявки"""
Expand Down Expand Up @@ -251,8 +253,8 @@ def OnDepoLimitDelete(self, data):
# cerebro.broker.setcommission(commission=0.0015)

# symbols = ('TQBR.SBER', 'TQBR.VTBR',) # Кортеж тикеров
symbols = ('TQBR.SBER', ) # Кортеж тикеров
# symbols = ('TQBR.VTBR', ) # Кортеж тикеров
# symbols = ('TQBR.SBER', ) # Кортеж тикеров
symbols = ('TQBR.VTBR', ) # Кортеж тикеров

all_lots = {}
all_step = {}
Expand Down Expand Up @@ -281,11 +283,11 @@ def OnDepoLimitDelete(self, data):
print("all_scale: ", all_scale)

# Добавляем торговую систему с лимитным входом в n%
cerebro.addstrategy(LimitCancel, LimitPct=15, all_step=all_step, all_lots=all_lots, all_scale=all_scale)
cerebro.addstrategy(LimitCancel, LimitPct=0.01, all_step=all_step, all_lots=all_lots, all_scale=all_scale)

for ticker in symbols:
data = store.getdata(dataname=ticker, timeframe=bt.TimeFrame.Minutes, compression=60,
fromdate=datetime(2022, 11, 10), sessionstart=time(7, 0),
data = store.getdata(dataname=ticker, timeframe=bt.TimeFrame.Minutes, compression=1,
fromdate=datetime(2022, 11, 14), sessionstart=time(7, 0),
LiveBars=True) # Исторические и новые минутные бары за все время
cerebro.adddata(data) # Добавляем данные

Expand Down
3 changes: 3 additions & 0 deletions таблица заявок.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
33449620127,10:41:15,Сбербанк,МБ ФР: Т+ Акции и ДР,SBER,B,L01+00000F00,LSQP ,M,136.35,0.00,1,,,1363.50,0.00,MU006190209C,MC0061900000,,593458R8NYF//FZQU251,Y2,593458R8NYF,,
33449830527,10:46:03,ВТБ ао,МБ ФР: Т+ Акции и ДР,VTBR,B,L01+00000F00,LSQP ,M,0.017130,0.00,1,,,171.30,0.00,MU006190209C,MC0061900000,,593458R8NYF//FZQU251,Y2,593458R8NYF,,
33449965138,10:49:01,Сбербанк,МБ ФР: Т+ Акции и ДР,SBER,S,L01+00000F00,LSQP ,M,136.00,0.00,1,,,1360.00,0.00,MU006190209C,MC0061900000,,593458R8NYF/,Y2,593458R8NYF,,
3 changes: 3 additions & 0 deletions таблица сделок.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
6834373317,33449620127,10:41:15,B,593458R8NYF//FZQU251,MU006190209C,,L01+00000F00,TQBR,SBER,136.33,1,1363.30,16.11.2022,,,N,0.00,Y2,T,,0.00,0.00,,,,0,,,,N,0.00,0.00,0.00,593458R8NYF,00671,,N,SUR,,14.11.2022
6834401958,33449830527,10:46:03,B,593458R8NYF//FZQU251,MU006190209C,,L01+00000F00,TQBR,VTBR,0.017125,1,171.25,16.11.2022,,,N,0.000000,Y2,T,,0.00,0.000000,,,,0,,,,N,0.00,0.00,0.00,593458R8NYF,00671,,N,SUR,,14.11.2022
6834420163,33449965138,10:49:23,S,593458R8NYF/,MU006190209C,,L01+00000F00,TQBR,SBER,136.00,1,1360.00,16.11.2022,,,N,0.00,Y2,T,,0.00,0.00,,,,0,,,,N,0.00,0.00,0.00,593458R8NYF,00671,,N,SUR,,14.11.2022
Loading

0 comments on commit 99c9e58

Please sign in to comment.