bogdanteodoru / py3cw

Unofficial wrapper for the 3Commas API written in Python
MIT License
89 stars 40 forks source link

Creating a bot returns error for strategy list #3

Closed AmmarKothari closed 4 years ago

AmmarKothari commented 4 years ago

I am trying to create a bot. I can get other information for the bot like stats.

success, out = py3cw.request(entity='bots', action='create_bot', payload=bots_def)

bots_def =
{'name': 'base_keiko', 'account_id': 105110, 'pairs': ['BNB_ADA', 'BNB_ALGO', 'BNB_ATOM', 'BNB_BAND', 'BNB_BLZ', 'BNB_CELR', 'BNB_DASH', 'BNB_ENJ', 'BNB_HBAR', 'BNB_IOST', 'BNB_IOTA', 'BNB_MATIC', 'BNB_NANO', 'BNB_ONE', 'BNB_ONT', 'BNB_REN', 'BNB_STX', 'BNB_TOMO', 'BNB_TRX', 'BNB_WABI', 'BNB_WAN'], 'max_active_deals': 21, 'base_order_volume': 0.2, 'base_order_volume_type': 'quote_currency', 'take_profit': 2.64, 'safety_order_volume': 0.1, 'safety_order_volume_type': 'quote_currency', 'martingale_volume_coefficient': 3.0, 'martingale_step_coefficient': 2.4, 'max_safety_orders': 3, 'active_safety_orders_count': 3, 'stop_loss_percentage': 0.0, 'cooldown': 0, 'trailing_enabled': False, 'trailing_deviation': 0.2, 'strategy': 'long', 'safety_order_step_percentage': 1.3, 'take_profit_type': 'total', 'strategy_list': [], 'leverage_type': 'not_specified', 'stop_loss_timeout_enabled': False, 'stop_loss_timeout_in_seconds': 0, 'min_volume_btc_24h': 0.0, 'tsl_enabled': False, 'profit_currency': 'quote_currency', 'start_order_type': 'limit', 'stop_loss_type': 'stop_loss', 'allowed_deals_on_same_pair': 1}

success returns -> {'error': 'record_invalid', 'error_description': 'Invalid parameters', 'error_attributes': {'strategy_list': ['is missing']}}

I am happy to fix the issue, but i don't know a lot about making requests. If you could point me in the right direction, I would be greatful!

bogdanteodoru commented 4 years ago

Hi AmmarKothari. It doesn't seem to be an error in the code itself. It seems to me like an error of the way the payload is sent. So there's not much to do but close this and leave it as a reference in case anybody else has this problem.

Later edit: Or send the issue to the 3commas official GitHub. Seems the error is from their side.

AmmarKothari commented 4 years ago

O. I see. It may be implemented differently/incorrectly on the 3c side?

I tried to play around with reformatting the payload for that one section and couldn’t get anything to work. I couldn’t figure out what the payload should actually look like.

I’ll follow up on the 3c github. Thanks.