Comments (9)
I was having similar issues.
- Make sure you are reading from the webhook not the file. I had to comment out line 44 and uncomment line 42 in webhook-bot.py. *
- Find the if statement you are hitting in actions.py and copy it to the first one just to test. I also had so much problems with it that I added print statements to every if statement I thought I was hitting.
from bybit-trading-bot-integrated-with-tradingview-webhook-alerts.
You are placing order of 4.5977364758395 when you balance is 2.6. I don't know if it can place such an, order. Also look at your JSON, the amount parameter is 0.1???? Put something like 97 and that is a percentage of your balance.
from bybit-trading-bot-integrated-with-tradingview-webhook-alerts.
The payload from your trading view has a issue stopLoss is missing. Make sure you include the stopLoss as a parameter.
from bybit-trading-bot-integrated-with-tradingview-webhook-alerts.
I made all of those changes you guys recommended. I'm still not getting trades and I'm still getting that 500 at the bottom of the code there, which I suspect is the reason the API isnt taking the trade. It says something there about trailing stops but I dont want to use trailing stops. Should I put trailing stop as 0 in my Json file?
from bybit-trading-bot-integrated-with-tradingview-webhook-alerts.
Okay if you dont want to use the trailingStop or any other parameter, include it on the payload but set it to None for example... "trailingStop":"None"
from bybit-trading-bot-integrated-with-tradingview-webhook-alerts.
I got rid of all of the errors but nothing seems to change the order amount. Its always 5000 something whether I change the quantity in the json or webhook. Nothing changes this. I'm soo close!!
from bybit-trading-bot-integrated-with-tradingview-webhook-alerts.
Here is the code.
(Bot-QKn0Xe1W) pi@pi-desktop:~/Bot$ python3 webhook-bot.py
- Serving Flask app 'webhook-bot' (lazy loading)
- Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead. - Debug mode: off
- Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Data as Literal {'type': 'market', 'side': 'buy', 'amount': '97', 'symbol': 'ETHUSD', 'stopLoss': '1', 'leverage': '3', 'key': 'bf110da8a214b863838dad8c7e1f0d4609a356a8460803dc6e14a2c1'}
Data Read From File {'type': 'market', 'side': 'buy', 'amount': '80', 'symbol': 'ETHUSD', 'stopLoss': '1', 'trailingStop': 'None', 'leverage': '3', 'key': 'bf110da8a214b863838dad8c7e1f0d4609a356a8460803dc6e14a2c1'}
Updated Data {'type': 'market', 'side': 'buy', 'amount': '97', 'symbol': 'ETHUSD', 'stopLoss': '1', 'trailingStop': 'None', 'leverage': '3', 'key': 'bf110da8a214b863838dad8c7e1f0d4609a356a8460803dc6e14a2c1'}
{'type': 'market', 'side': 'buy', 'amount': '97', 'symbol': 'ETHUSD', 'stopLoss': '1', 'trailingStop': 'None', 'leverage': '3', 'key': 'bf110da8a214b863838dad8c7e1f0d4609a356a8460803dc6e14a2c1'}
[Alert Received]
POST Received/Updated Data: {'type': 'market', 'side': 'buy', 'amount': '97', 'symbol': 'ETHUSD', 'stopLoss': '1', 'trailingStop': 'None', 'leverage': '3', 'key': 'bf110da8a214b863838dad8c7e1f0d4609a356a8460803dc6e14a2c1'}
Sending: ETHUSD market buy 97
Trading Amount: 97
Side: buy
Type: market
Wallet Balance ----------------------------------------------------------
Wallet Balance------------------------------------------------(((( {'ret_code': 0, 'ret_msg': 'OK', 'ext_code': '', 'ext_info': '', 'result': {'ETH': {'equity': 2.61628957, 'available_balance': 2.61628957, 'used_margin': 0, 'order_margin': 0, 'position_margin': 0, 'occ_closing_fee': 0, 'occ_funding_fee': 0, 'wallet_balance': 2.61628957, 'realised_pnl': 0, 'unrealised_pnl': 0, 'cum_realised_pnl': 0, 'given_cash': 0, 'service_cash': 0}}, 'time_now': '1627352589.495674', 'rate_limit_status': 118, 'rate_limit_reset_ms': 1627352589490, 'rate_limit': 120}
2.61628957
Place Order Amount
Int Amount Percentage 0.97
Wallet Balance 2.61628957
Leverage ----------------------------------------------------------
{
"ret_code": 0,
"ret_msg": "ok",
"ext_code": "",
"result": {
"BTCUSD": {
"leverage": 100
},
"ETHUSD": {
"leverage": 4
},
"EOSUSD": {
"leverage": 50
},
"XRPUSD": {
"leverage": 50
}
},
"ext_info": null,
"time_now": "1627352589.838575",
"rate_limit_status": 110,
"rate_limit_reset_ms": 1627352589851,
"rate_limit": 120
}
Leverage Value 4
Position ----------------------------------------------------------
Position Result Value [{'data': {'id': 0, 'position_idx': 0, 'mode': 0, 'user_id': 234826, 'risk_id': 1, 'symbol': 'BTCUSD', 'side': 'None', 'size': 0, 'position_value': '0', 'entry_price': '0', 'is_isolated': False, 'auto_add_margin': 0, 'leverage': '100', 'effective_leverage': '100', 'position_margin': '0', 'liq_price': '0', 'bust_price': '0', 'occ_closing_fee': '0', 'occ_funding_fee': '0', 'take_profit': '0', 'stop_loss': '0', 'trailing_stop': '0', 'position_status': 'Normal', 'deleverage_indicator': 0, 'oc_calc_data': '{"blq":0,"slq":0,"bmp":0,"smp":0,"bv2c":0.0115075,"sv2c":0.0114925}', 'order_margin': '0', 'wallet_balance': '0', 'realised_pnl': '0', 'unrealised_pnl': 0, 'cum_realised_pnl': '0', 'cross_seq': 3892578659, 'position_seq': 0, 'created_at': '2021-07-22T10:28:47.716739028Z', 'updated_at': '2021-07-22T16:00:01.817105094Z', 'tp_sl_mode': 'Full'}, 'is_valid': True}, {'data': {'id': 0, 'position_idx': 0, 'mode': 0, 'user_id': 234826, 'risk_id': 21, 'symbol': 'EOSUSD', 'side': 'None', 'size': 0, 'position_value': '0', 'entry_price': '0', 'is_isolated': False, 'auto_add_margin': 0, 'leverage': '50', 'effective_leverage': '50', 'position_margin': '0', 'liq_price': '0', 'bust_price': '0', 'occ_closing_fee': '0', 'occ_funding_fee': '0', 'take_profit': '0', 'stop_loss': '0', 'trailing_stop': '0', 'position_status': 'Normal', 'deleverage_indicator': 0, 'oc_calc_data': '{"blq":0,"slq":0,"bmp":0,"smp":0,"bv2c":0.021515,"sv2c":0.021485}', 'order_margin': '0', 'wallet_balance': '0', 'realised_pnl': '0', 'unrealised_pnl': 0, 'cum_realised_pnl': '0', 'cross_seq': 1259973943, 'position_seq': 0, 'created_at': '2021-07-22T10:28:47.716679751Z', 'updated_at': '2021-07-22T16:00:01.839679054Z', 'tp_sl_mode': 'Full'}, 'is_valid': True}, {'data': {'id': 0, 'position_idx': 0, 'mode': 0, 'user_id': 234826, 'risk_id': 11, 'symbol': 'ETHUSD', 'side': 'None', 'size': 0, 'position_value': '0', 'entry_price': '0', 'is_isolated': True, 'auto_add_margin': 0, 'leverage': '4', 'effective_leverage': '4', 'position_margin': '0', 'liq_price': '0', 'bust_price': '0', 'occ_closing_fee': '0', 'occ_funding_fee': '0', 'take_profit': '0', 'stop_loss': '0', 'trailing_stop': '0', 'position_status': 'Normal', 'deleverage_indicator': 0, 'oc_calc_data': '{"blq":0,"slq":0,"bmp":0,"smp":0,"bv2c":0.2516875,"sv2c":0.2513125}', 'order_margin': '0', 'wallet_balance': '2.61628957', 'realised_pnl': '0', 'unrealised_pnl': 0, 'cum_realised_pnl': '0', 'cross_seq': 2580696652, 'position_seq': 0, 'created_at': '2021-07-17T14:27:35.996668921Z', 'updated_at': '2021-07-27T01:39:54.366119857Z', 'tp_sl_mode': 'Full'}, 'is_valid': True}, {'data': {'id': 0, 'position_idx': 0, 'mode': 0, 'user_id': 234826, 'risk_id': 31, 'symbol': 'XRPUSD', 'side': 'None', 'size': 0, 'position_value': '0', 'entry_price': '0', 'is_isolated': False, 'auto_add_margin': 1, 'leverage': '50', 'effective_leverage': '50', 'position_margin': '0', 'liq_price': '0', 'bust_price': '0', 'occ_closing_fee': '0', 'occ_funding_fee': '0', 'take_profit': '0', 'stop_loss': '0', 'trailing_stop': '0', 'position_status': 'Normal', 'deleverage_indicator': 0, 'oc_calc_data': '{"blq":0,"slq":0,"bmp":0,"smp":0,"bv2c":0.021515,"sv2c":0.021485}', 'order_margin': '0', 'wallet_balance': '0', 'realised_pnl': '0', 'unrealised_pnl': 0, 'cum_realised_pnl': '0', 'cross_seq': 1410445185, 'position_seq': 0, 'created_at': '2021-06-20T20:57:35.653496369Z', 'updated_at': '2021-07-22T16:00:01.82554943Z', 'tp_sl_mode': 'Full'}, 'is_valid': True}]
Position Result None
Position Take Profit 0
Position Stop Loss 0
Order ID ----------------------------------------------------------
Example Order ID 0
{
"ret_code": 0,
"ret_msg": "OK",
"ext_code": "",
"ext_info": "",
"result": [
{
"symbol": "ETHUSD",
"bid_price": "2181.75",
"ask_price": "2181.8",
"last_price": "2182.05",
"last_tick_direction": "PlusTick",
"prev_price_24h": "2303.00",
"price_24h_pcnt": "-0.052518",
"high_price_24h": "2433.00",
"low_price_24h": "2160.15",
"prev_price_1h": "2180.95",
"price_1h_pcnt": "0.000504",
"mark_price": "2181.83",
"index_price": "2181.68",
"open_interest": 23171068,
"open_value": "16039.00",
"total_turnover": "214490751.83",
"turnover_24h": "107215.47",
"total_volume": 114747598874,
"volume_24h": 248164455,
"funding_rate": "0.0001",
"predicted_funding_rate": "0.0001",
"next_funding_time": "2021-07-27T08:00:00Z",
"countdown_hour": 6,
"delivery_fee_rate": "0",
"predicted_delivery_price": "",
"delivery_time": ""
}
],
"time_now": "1627352595.708936"
}
Tickers [{'symbol': 'ETHUSD', 'bid_price': '2181.75', 'ask_price': '2181.8', 'last_price': '2182.05', 'last_tick_direction': 'PlusTick', 'prev_price_24h': '2303.00', 'price_24h_pcnt': '-0.052518', 'high_price_24h': '2433.00', 'low_price_24h': '2160.15', 'prev_price_1h': '2180.95', 'price_1h_pcnt': '0.000504', 'mark_price': '2181.83', 'index_price': '2181.68', 'open_interest': 23171068, 'open_value': '16039.00', 'total_turnover': '214490751.83', 'turnover_24h': '107215.47', 'total_volume': 114747598874, 'volume_24h': 248164455, 'funding_rate': '0.0001', 'predicted_funding_rate': '0.0001', 'next_funding_time': '2021-07-27T08:00:00Z', 'countdown_hour': 6, 'delivery_fee_rate': '0', 'predicted_delivery_price': '', 'delivery_time': ''}]
Last Price 2182.05
Position Entry Price 0
Bid Price Value Two 0.0
Order Amount 5708.089769347501
Order Amount in USD 5536.847076267076
Active Order Real Time ----------------------------------------------------------
Real time active order result {'current_page': 1, 'last_page': 1, 'data': []}
Real time active order result Intented Results {'current_page': 1, 'last_page': 1, 'data': []}
End of WebHook Execution
127.0.0.1 - - [26/Jul/2021 21:23:16] "POST /webhook HTTP/1.1" 200 -
from bybit-trading-bot-integrated-with-tradingview-webhook-alerts.
check for current update
from bybit-trading-bot-integrated-with-tradingview-webhook-alerts.
Fixed as per current updates. Follow feedback on Discord
from bybit-trading-bot-integrated-with-tradingview-webhook-alerts.
Related Issues (13)
- When running webhook-bot.py HOT 1
- Does not post open trade in bybit account HOT 3
- 500 Errors and no communication with Bybit HOT 3
- Automatically Closing Previously Opened Positions HOT 1
- Invalid request : please check your timestamp
- Option to choose BTC or USDT
- NoneType for property result while getting from get_wallet_balance HOT 3
- Earn
- Trailing Stop HOT 1
- syntax error in actions.py HOT 1
- error in actions.py, line 2179 HOT 2
- TypeError: string indices must be integers HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bybit-trading-bot-integrated-with-tradingview-webhook-alerts.