bugfix
This commit is contained in:
Binary file not shown.
@ -39,7 +39,7 @@ class LiveInterface(GeneralInterface):
|
||||
|
||||
return market_order.id
|
||||
except Exception as e:
|
||||
print("Nepodarilo se odeslat ", str(e))
|
||||
print("Nepodarilo se odeslat buy", str(e))
|
||||
return -1
|
||||
|
||||
"""buy limit"""
|
||||
@ -86,7 +86,7 @@ class LiveInterface(GeneralInterface):
|
||||
|
||||
return market_order.id
|
||||
except Exception as e:
|
||||
print("Nepodarilo se odeslat ", str(e))
|
||||
print("Nepodarilo se odeslat sell", str(e))
|
||||
return -1
|
||||
|
||||
"""sell limit"""
|
||||
@ -111,7 +111,7 @@ class LiveInterface(GeneralInterface):
|
||||
return limit_order.id
|
||||
|
||||
except Exception as e:
|
||||
print("Nepodarilo se odeslat ", str(e))
|
||||
print("Nepodarilo se odeslat sell_l", str(e))
|
||||
#raise Exception(e)
|
||||
return -1
|
||||
|
||||
|
||||
@ -34,18 +34,33 @@
|
||||
}
|
||||
|
||||
#msgContainer {
|
||||
display: grid;
|
||||
display: inline-block;
|
||||
overflow: auto;
|
||||
height: 568px;
|
||||
}
|
||||
|
||||
.msgContainerInner {
|
||||
display: flex;
|
||||
overflow: auto;
|
||||
height: 568px;
|
||||
flex-direction: column-reverse;
|
||||
/* na male obrazovce je log pod grafem, zobrazujeme tedy prvni logy nahore */
|
||||
@media (max-width : 1680px) {
|
||||
.msgContainerInner {
|
||||
display: flex;
|
||||
overflow: auto;
|
||||
height: 568px;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width : 1681px) {
|
||||
.msgContainerInner {
|
||||
display: flex;
|
||||
overflow: auto;
|
||||
height: 568px;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
pre {
|
||||
display: block;
|
||||
/* padding: 9.5px; */
|
||||
|
||||
@ -36,6 +36,9 @@ class StrategyOrderLimitVykladaci(Strategy):
|
||||
self.state.avgp = float(data.price)
|
||||
price=price2dec(float(o.filled_avg_price)+self.state.vars.profit)
|
||||
self.state.vars.limitka = await self.interface.sell_l(price=price, size=o.filled_qty)
|
||||
#obcas live vrati "held for orders", odchytime chybu a limitku nevytvarime - spravi to dalsi notifikace nebo konzolidace
|
||||
if self.state.vars.limitka == -1:
|
||||
self.state.vars.limitka = None
|
||||
self.state.vars.limitka_price = price
|
||||
self.state.ilog(e="Příchozí BUY notif - vytvarime limitku", msg="order status:"+o.status, orderid=str(o.id), limitka=str(self.state.vars.limitka), limtka_price=self.state.vars.limitka_price)
|
||||
else:
|
||||
@ -45,6 +48,9 @@ class StrategyOrderLimitVykladaci(Strategy):
|
||||
try:
|
||||
puvodni = self.state.vars.limitka
|
||||
self.state.vars.limitka = await self.interface.repl(price=cena,orderid=self.state.vars.limitka,size=int(self.state.positions))
|
||||
#odchyceni pripadne chyby na live
|
||||
if self.state.vars.limitka == -1:
|
||||
self.state.vars.limitka = puvodni
|
||||
self.state.vars.limitka_price = cena
|
||||
self.state.ilog(e="Příchozí BUY notif - menime limitku", msg="order status:"+o.status, orderid=str(o.id), limitka=str(self.state.vars.limitka), limtka_price=self.state.vars.limitka_price, puvodni_limitka=str(puvodni))
|
||||
except APIError as e:
|
||||
@ -60,11 +66,19 @@ class StrategyOrderLimitVykladaci(Strategy):
|
||||
if data.event == TradeEvent.PARTIAL_FILL:
|
||||
self.state.ilog(e="SELL notifikace - Partial fill", msg="pouze update pozic", orderid=str(data.order.id))
|
||||
ic("partial fill jen udpatujeme pozice")
|
||||
#TODO tento update mozna vyhodit a pockat vzdy na plny fill - otestovat az bude cas
|
||||
self.state.avgp, self.state.positions = self.interface.pos()
|
||||
elif data.event == TradeEvent.FILL or data.event == TradeEvent.CANCELED:
|
||||
print("Příchozí SELL notifikace - complete FILL nebo CANCEL", data.event)
|
||||
#muzeme znovu nakupovat, mazeme limitku, blockbuy a pendingbuys
|
||||
#self.state.blockbuy = 0
|
||||
|
||||
#ADDPROFIT - datd o funkce
|
||||
prodej = data.order.filled_qty * data.order.filled_avg_price
|
||||
nakup = self.state.positions
|
||||
|
||||
|
||||
|
||||
ic("notifikace sell mazeme limitku a update pozic")
|
||||
#updatujeme pozice
|
||||
self.state.avgp, self.state.positions = self.interface.pos()
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -48,6 +48,7 @@ class Strategy:
|
||||
self.account = account
|
||||
self.key = get_key(mode=self.mode, account=self.account)
|
||||
self.rtqueue = None
|
||||
self.profit = 0
|
||||
|
||||
|
||||
#TODO predelat na dynamické queues
|
||||
|
||||
Reference in New Issue
Block a user