forked from kodorvan/stcs
Update
This commit is contained in:
@@ -280,14 +280,17 @@ async def open_market_order(tg_id, message, api_key, secret_key):
|
||||
await contract_long(tg_id, message, margin_mode)
|
||||
elif trading_mode == 'Short':
|
||||
await contract_short(tg_id, message, margin_mode)
|
||||
else:
|
||||
await message.answer("Неизвестный режим торговли: выберите Long или Short.")
|
||||
elif trading_mode == 'Smart':
|
||||
await message.answer("Режим Smart пока недоступен")
|
||||
elif trading_mode == 'Switch':
|
||||
await message.answer("Режим Switch пока недоступен")
|
||||
|
||||
|
||||
async def open_limit_order(tg_id, message, price, api_key, secret_key):
|
||||
data_main_stgs = await rq.get_user_main_settings(tg_id)
|
||||
trading_mode = data_main_stgs['trading_mode']
|
||||
margin_mode = data_main_stgs.get('margin_type')
|
||||
order_type = await rq.get_entry_order_type(tg_id)
|
||||
|
||||
|
||||
client = HTTP(
|
||||
@@ -297,7 +300,7 @@ async def open_limit_order(tg_id, message, price, api_key, secret_key):
|
||||
|
||||
symbol = await rq.get_symbol(tg_id)
|
||||
qty = float(data_main_stgs['starting_quantity'])
|
||||
side = 'Buy' if trading_mode == 'Long' else 'Sell'
|
||||
side = 'Buy' if trading_mode == 'Long' else 'Short'
|
||||
|
||||
|
||||
try:
|
||||
@@ -313,6 +316,8 @@ async def open_limit_order(tg_id, message, price, api_key, secret_key):
|
||||
)
|
||||
if response.get('retCode') == 0:
|
||||
await message.answer(f"Limit ордер открыт: {side} {qty} {symbol} по цене {price}")
|
||||
await rq.update_user_trades(tg_id, symbol=symbol, side=order_type)
|
||||
|
||||
else:
|
||||
await message.answer(f"Ошибка открытия ордера: {response.get('retMsg')}")
|
||||
except Exception as e:
|
||||
|
Reference in New Issue
Block a user