nicknochnack / MLTradingBot

708 stars 280 forks source link

Paper Trader didn't place a trade. #7

Open coininstant opened 5 months ago

coininstant commented 5 months ago

Monitoring the bot, however it has yet to place a paper trade. This is all it does below: 0|tradingb | 2024-01-30 17:55:46,774: root: INFO: mlstrat : Executing the initialize lifecycle method 0|tradingb | 2024-01-30 17:55:58,085: root: INFO: mlstrat : Executing the before_starting_trading lifecycle method 0|tradingb | 2024-01-30 17:55:58,224: root: INFO: mlstrat : Strategy will check in again at: 2024-01-30 18:00:00 0|tradingb | 2024-01-30 17:58:49,988: root: INFO: Untracked order 211b4005-1fc2-45be-a5a6-8bb9b752ecac was logged by broker alpaca 0|tradingb | 2024-01-30 17:58:49,999: root: INFO: Untracked order 211b4005-1fc2-45be-a5a6-8bb9b752ecac was logged by broker alpaca 0|tradingb | 2024-01-30 17:58:50,611: root: INFO: Untracked order 211b4005-1fc2-45be-a5a6-8bb9b752ecac was logged by broker alpaca

0|tradingbot | 2024-01-30 18:00:02,463: root: INFO: mlstrat : Executing the on_trading_iteration lifecycle method at 2024-01-30 18:00:00 0|tradingbot | 2024-01-30 18:00:09,850: root: INFO: mlstrat : Trading iteration ended at 2024-01-30 18:00:09, next check in time is 2024-01-30 19:00:00 0|tradingbot | 2024-01-30 18:00:28,894: root: INFO: Untracked order aac780c5-b378-4c91-a8cd-b348c3cd7f21 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:00:28,901: root: INFO: Untracked order aac780c5-b378-4c91-a8cd-b348c3cd7f21 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:00:29,199: root: INFO: Untracked order aac780c5-b378-4c91-a8cd-b348c3cd7f21 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:00:56,551: root: INFO: Untracked order c373fc64-7561-433f-81c2-2a829a93f903 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:00:56,566: root: INFO: Untracked order c373fc64-7561-433f-81c2-2a829a93f903 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:00:57,197: root: INFO: Untracked order c373fc64-7561-433f-81c2-2a829a93f903 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:01:24,988: root: INFO: Untracked order e591619d-1511-4024-b2aa-d20d094461d8 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:01:24,996: root: INFO: Untracked order e591619d-1511-4024-b2aa-d20d094461d8 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:01:25,505: root: INFO: Untracked order e591619d-1511-4024-b2aa-d20d094461d8 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:01:32,146: root: INFO: Untracked order d564aeb1-2d8e-4142-b1c7-688c93741af0 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:01:32,154: root: INFO: Untracked order d564aeb1-2d8e-4142-b1c7-688c93741af0 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:01:32,578: root: INFO: Untracked order d564aeb1-2d8e-4142-b1c7-688c93741af0 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:01:39,279: root: INFO: Untracked order 6e3b7600-53d9-401c-a853-2e95caf22b4b was logged by broker alpaca 0|tradingbot | 2024-01-30 18:01:39,287: root: INFO: Untracked order 6e3b7600-53d9-401c-a853-2e95caf22b4b was logged by broker alpaca 0|tradingbot | 2024-01-30 18:01:39,762: root: INFO: Untracked order 6e3b7600-53d9-401c-a853-2e95caf22b4b was logged by broker alpaca 0|tradingbot | 2024-01-30 18:02:00,070: root: INFO: Untracked order 7a02326a-5b71-4559-9a41-0817bc19743f was logged by broker alpaca 0|tradingbot | 2024-01-30 18:02:00,084: root: INFO: Untracked order 7a02326a-5b71-4559-9a41-0817bc19743f was logged by broker alpaca 0|tradingbot | 2024-01-30 18:02:00,521: root: INFO: Untracked order 7a02326a-5b71-4559-9a41-0817bc19743f was logged by broker alpaca 0|tradingbot | 2024-01-30 18:05:45,112: root: INFO: Untracked order ead92392-c849-4b2e-af58-343678100566 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:05:45,131: root: INFO: Untracked order ead92392-c849-4b2e-af58-343678100566 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:05:45,676: root: INFO: Untracked order ead92392-c849-4b2e-af58-343678100566 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:09:54,951: root: INFO: Untracked order 593bc5fa-2e8f-4b30-bf16-7539be40d700 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:09:54,974: root: INFO: Untracked order 593bc5fa-2e8f-4b30-bf16-7539be40d700 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:09:55,465: root: INFO: Untracked order 593bc5fa-2e8f-4b30-bf16-7539be40d700 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:10:11,882: root: INFO: Untracked order fa5bcc44-797a-427d-9572-35bcf39a1cc2 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:10:11,891: root: INFO: Untracked order fa5bcc44-797a-427d-9572-35bcf39a1cc2 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:10:12,164: root: INFO: Untracked order fa5bcc44-797a-427d-9572-35bcf39a1cc2 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:10:42,036: root: INFO: Untracked order d71aa6fc-d2fd-4b0a-a575-9c8305b20bdc was logged by broker alpaca 0|tradingbot | 2024-01-30 18:10:42,052: root: INFO: Untracked order d71aa6fc-d2fd-4b0a-a575-9c8305b20bdc was logged by broker alpaca 0|tradingbot | 2024-01-30 18:10:42,459: root: INFO: Untracked order d71aa6fc-d2fd-4b0a-a575-9c8305b20bdc was logged by broker alpaca 0|tradingbot | 2024-01-30 18:10:48,389: root: INFO: Untracked order 1037325a-4044-4294-8f3f-1308c758eeb1 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:10:48,397: root: INFO: Untracked order 1037325a-4044-4294-8f3f-1308c758eeb1 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:10:48,606: root: INFO: Untracked order 1037325a-4044-4294-8f3f-1308c758eeb1 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:11:46,978: root: INFO: Untracked order 781c8314-39bd-4c40-b6c1-3cc8e2557429 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:11:46,990: root: INFO: Untracked order 781c8314-39bd-4c40-b6c1-3cc8e2557429 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:11:47,137: root: INFO: Untracked order 781c8314-39bd-4c40-b6c1-3cc8e2557429 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:13:14,847: root: INFO: Untracked order cc01b60f-5a7f-45e4-80a9-e8d2921ccfe8 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:13:14,854: root: INFO: Untracked order cc01b60f-5a7f-45e4-80a9-e8d2921ccfe8 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:13:15,392: root: INFO: Untracked order cc01b60f-5a7f-45e4-80a9-e8d2921ccfe8 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:17:05,043: root: INFO: Untracked order 12f8ed3d-96d6-4238-a46f-be2e1d1c61c5 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:17:05,049: root: INFO: Untracked order 12f8ed3d-96d6-4238-a46f-be2e1d1c61c5 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:17:05,216: root: INFO: Untracked order 12f8ed3d-96d6-4238-a46f-be2e1d1c61c5 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:17:48,565: root: INFO: Untracked order 645f82a8-30cf-4534-8e08-b7aa024fd248 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:17:48,574: root: INFO: Untracked order 645f82a8-30cf-4534-8e08-b7aa024fd248 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:17:48,905: root: INFO: Untracked order 645f82a8-30cf-4534-8e08-b7aa024fd248 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:17:52,527: root: INFO: Untracked order dab9ae3d-9357-404b-ada6-2fb965d96a62 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:17:52,537: root: INFO: Untracked order dab9ae3d-9357-404b-ada6-2fb965d96a62 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:17:53,062: root: INFO: Untracked order dab9ae3d-9357-404b-ada6-2fb965d96a62 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:19:41,944: root: INFO: Untracked order e94821a5-858a-4dd7-a452-60b004c711ef was logged by broker alpaca 0|tradingbot | 2024-01-30 18:19:41,969: root: INFO: Untracked order e94821a5-858a-4dd7-a452-60b004c711ef was logged by broker alpaca 0|tradingbot | 2024-01-30 18:19:42,456: root: INFO: Untracked order e94821a5-858a-4dd7-a452-60b004c711ef was logged by broker alpaca 0|tradingbot | 2024-01-30 18:21:33,256: root: INFO: Untracked order 9c15fcc3-bdba-413b-ada0-92870d041915 was logged by broker alpaca 0|tradingbot | 2024-01-30 18:21:33,265: root: INFO: Untracked order 9c15fcc3-bdba-413b-ada0-92870d041915 was logged by broker alpaca

rkaushik29 commented 5 months ago

Make sure you use the paper trading keys, they're different from live trading keys. Also try not to run it from a VSCode like terminal - use the OS native terminal. Check the python environment you're running it on as well

coininstant commented 5 months ago

Make sure you use the paper trading keys, they're different from live trading keys. Also try not to run it from a VSCode like terminal - use the OS native terminal. Check the python environment you're running it on as well

i'm running it on an EC2 server, have the paper trading keys in so it should work. I think my issue might just be the length of time I was running it, and the fact that spy news probably never hit when the bot was on. Thinking back all the spy news hit the next day after i stopped the bot around fed day so I will give this another longer test, hopefully, that's the issue. Thanks!

mohamed-alired commented 3 months ago

were you able to place a trade with paper trader using that bot

coininstant commented 3 months ago

No I never actually went back to re-test this script, I just figured if it did work then it wasn't making trades in a timely manner for me, also I ended up getting caught up in a few other projects and didn't have time to debug this issue. I've used many other scripts with Alpaca and never have had an issue getting the api to trade with the paper and live accounts. It looks like we should be able to get this one to work, I saw a few tweaks in the other issue threads that might be the fix, but the strategy of this bot, trading on the news sentiment, might not be the best idea for profitability anyway, so I decided to run with some other bots and build my own trading bots for now. I think sentiment must be used in conjunction with some other technical indicators to get the best of both worlds. I tested another news based alpaca bot and got it working, this strategy can make some good day trades on spikes created by the news, but that's just it you still need to sell them on the spike right away because usually if you hold overnight or wait till a negative news event to let the bot sell it will be way too late to profit, and this can be dangerous. On a good news day spike you will usually get caught after everyone sells on the news. Maybe running these types of scripts in reverse could work too, just an idea, but i'm not comfortable shorting a lot of stocks overnight with bots. I might revisit this script in the future, maybe use it in conjunction with another script that uses ta patterns.

mohamed-alired commented 3 months ago

that's really informative i made it work after debugging and reviewed the code and knew that it's not good to build the whole strategy based on news btw you can tweak the time to make trades but can you refer me to other trading bots using alpaca with a mixed strategy