From dcf240780694b20ad1ac793a471aa1da12f85879 Mon Sep 17 00:00:00 2001 From: David Brazda Date: Tue, 9 May 2023 16:49:21 +0200 Subject: [PATCH] bugfix --- testy/moduleTests/liveInterfaceTest.py | 6 +++--- v2realbot/ENTRY_backtest_strategyVykladaci.py | 4 ++-- .../enums/__pycache__/enums.cpython-310.pyc | Bin 2304 -> 2324 bytes v2realbot/enums/enums.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/testy/moduleTests/liveInterfaceTest.py b/testy/moduleTests/liveInterfaceTest.py index 49af66a..2a88370 100644 --- a/testy/moduleTests/liveInterfaceTest.py +++ b/testy/moduleTests/liveInterfaceTest.py @@ -1,5 +1,5 @@ from v2realbot.config import Keys, get_key -from v2realbot.enums.enums import Mode, Account, OrderSide +from v2realbot.enums.enums import Mode, Account, OrderSide, OrderType from v2realbot.interfaces.live_interface import LiveInterface from msgpack import packb, unpackb key = get_key(mode=Mode.PAPER, account=Account.ACCOUNT1) @@ -20,7 +20,7 @@ if int(data["index"])%int(consolidation_bar_count) == 0: print("***Consolidation ENTRY***") orderlist = li.get_open_orders(symbol=symbol, side=None) - #print(orderlist) + print(orderlist) pendingbuys_new = {} limitka = None jevylozeno = 1 @@ -29,7 +29,7 @@ if int(data["index"])%int(consolidation_bar_count) == 0: print("Puvodni LIMITKA", limitka) limitka = o.id print("Přepsaná LIMITKA", limitka) - if o.side == OrderSide.BUY: + if o.side == OrderSide.BUY and o.order_type == OrderType.LIMIT: pendingbuys_new[str(o.id)]=o.limit_price if pendingbuys_new != pendingbuys: diff --git a/v2realbot/ENTRY_backtest_strategyVykladaci.py b/v2realbot/ENTRY_backtest_strategyVykladaci.py index 6b157ae..037f0f5 100644 --- a/v2realbot/ENTRY_backtest_strategyVykladaci.py +++ b/v2realbot/ENTRY_backtest_strategyVykladaci.py @@ -2,7 +2,7 @@ import os,sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from v2realbot.strategy.base import StrategyState from v2realbot.strategy.StrategyOrderLimitVykladaci import StrategyOrderLimitVykladaci -from v2realbot.enums.enums import RecordType, StartBarAlign, Mode, Account, OrderSide +from v2realbot.enums.enums import RecordType, StartBarAlign, Mode, Account, OrderSide, OrderType from v2realbot.indicators.indicators import ema from v2realbot.utils.utils import ltp, isrising, isfalling,trunc,AttributeDict, zoneNY, price2dec, dict_replace_value, print, safe_get from datetime import datetime @@ -305,7 +305,7 @@ def next(data, state: StrategyState): print("prepocitavam filledmnozstvi od limitka_qty a filled_qty", limitka_qty, limitka_filled_qty) limitka_qty = int(limitka_qty) - int(limitka_filled_qty) ##TODO sem pridat upravu ceny - if o.side == OrderSide.BUY: + if o.side == OrderSide.BUY and o.order_type == OrderType.LIMIT: pendingbuys_new[str(o.id)]=float(o.limit_price) state.ilog(e="Konzolidace limitky", msg=f"stejna:{(str(limitka_old)==str(state.vars.limitka))}", limitka_old=str(limitka_old), limitka_new=str(state.vars.limitka), limitka_new_price=state.vars.limitka_price, limitka_qty=limitka_qty, limitka_filled_qty=limitka_filled_qty) diff --git a/v2realbot/enums/__pycache__/enums.cpython-310.pyc b/v2realbot/enums/__pycache__/enums.cpython-310.pyc index 7abbfb4f052b02975a63f49c885b7374dd14de63..153090751f7bdc2186184e60df5d7436ad087204 100644 GIT binary patch delta 859 zcmZvZ!E4k&6vi{jWHQMnX-V5vacj3$>BcUeJoHcsTe@no?v~xH;!s%DPJ}{tS0=j$ zPbw9>c&YL3*`o;lF@xYu@a#X}duu>i5_muIzI^k|o6MW&QxuMaz%$_K9tml(^RPlb zoNp|@9@@et#sfoIlD;z}Ju?M^&Xx>1mN*GHqk@CtNDd0m6&Dm&dZ2i@;(=0! zlt2k&2uheMzMShC@%(R`BPNRm zie+zE<=aQgA?+n}lo3||+UfV@__*H}^nRn;)3m$aep(n>0rxyqii2~563RGH6$oA? z*E426+Pj#nZh%j%B5opz2Cc$}Yf%3)Ey%3mu-SK8+|}0effD}lcr-Z~O~)y8+McL^ zOj@y{F7KCZv+_pKHn(7l6{tV>r)Q&6N;t_@ofWc{eP&w^FGqn-+Xsz^;Bz3~yFlMc{R)DgsZZW;5WbqEOAZhGRKBO|}U*QoKdqSR^5dg2;_n{~$CktM-Ce>n0LJ}3`64T5I1x;W!IZB0k z@FbQIkAg=pg7`Q1Pb?nvqIl`WgIC{+3sT&H_hH_5XTI;vV_%2Q!eH$Ct_JJtkK5um zI}Db|i^I#+eWKmcgdym2P0$0KGsu`QAu|&*AqSLOpjg5N#m*HQ6i2wAxVhqhQW730 zUaq*H_#yx$$d!_q>uS;bPwXKg8Lf||Pa=IOb6Qd)vb!getn_y~8BC_>$D>PR(}c6q zLf8lgfsc?L!bb#%5+HIjnkJ7QNxY;Q`UZWk$p!UP|8nI7o>@4K5K{&)AW{mjwd+JO z^~zlS^vs?6@}9Cwmc z^jt-(A&MGXfe)u4Qhc|qQ9=!y$Q5i(eP(>08@mI^z2SH?*&9vADQ0XU2O?=kmMo~p zjjg!D=}jc-b>dpRuv+Phvx}3;+46BYP>BCjkll& None: self.id = id