mogden16 / TradierTDA_Trader

Options Trading Program that integrates TDA & Tradier. It gets it's alerts from Gmail & Discord
17 stars 6 forks source link

STRATEGIES #1

Open regholl opened 2 years ago

regholl commented 2 years ago

hello,,i have made both a buy and sell strategy in TOS and they are sending out emails.my question is where in the script do i add the strategies also how do i add them to mongo?

mogden16 commented 2 years ago

Your mongo will be connected to the bot by plugging in your MONGO_URI to the config.py file. Once the bot is running and connected to mongo, if your config.py RUN_TA is set to False, then it will buy the equities/options as soon as the email comes in. This bot is set to specifically exit your strategy based off OCO or a trailing stop, so your sell strategy won't do anything. If you want a custom sell, then I recommend continuing with Trey Thomas's bot which this was built on.

regholl commented 2 years ago

thanks,the config.run ta was set to true so ill see if it responds now

regholl commented 2 years ago

it;s just deleting the emails with no buy

mogden16 commented 2 years ago

Are you running TD or Tradier? If the email is printing a line in the terminal, then whatever trader you're using must not be set up correctly. When the bot first boots, it should say: Connecting to Mongo Connected to Mongo Connecting to Gmail Connected to Gmail Connecting to TDAmeritrade Connected to TDAmeritrade Running TDAmeritrade (or Tradier) Paper Trader Starting Tasks for: Starting Websocket for:

regholl commented 2 years ago

it's setup to the point where it says it's streaming and zero positions held.i'm going to have a closer look at tasks but wont know anything til the market opens again

mogden16 commented 2 years ago

Is run_gmail = True? Seems like you're almost there. You can adjust the turn_off_trades, sell_all_positions, and shutdown_time to a time further than right now and send yourself emails to check it out

regholl commented 2 years ago

i'm running TD only as live trader and gmail,both set to true.mongo is connected cause i can seee the users file.RUN TA is false.run tasks was set to false but is true now.websocket is true.yeah i am almost there.your algo is actually one of the best ones on here the rest are just garbage.whatever im doing wrong i had this same problem with trey thomas's where i could never get the bot to read the email but would delete them

regholl commented 2 years ago

i MAY have found the problem.i have live trader set in the script but in mongo it says its set to paper trade.

mogden16 commented 2 years ago

I still think the order would have to show up. I want to transition the bot to read what's under the user account in mongo, but right now, the bot is strictly reading what's in config.py.
When setting this up initially, I definitely recommend trading with paper so that none of your capital is actually risked.

regholl commented 2 years ago

rule 101 of stocks,don't play with money you cant afford to use..i bave been doing paper trading for 6 months until i could find a suitable bot.that being said i just reauthorized tda and it keeps adding paper back to the mongo user file

mogden16 commented 2 years ago

Ignore what it says in mongo. If your code says RUNNING LIVE TRADER in the terminal, then you're running live

regholl commented 2 years ago

ugh,all the errors i found and stil stuck in the same problem

mogden16 commented 2 years ago

Are you sure the alert in the email is set up correctly? The subject line should come in something like this:

Alert: New symbols: .AMD220506P89, were added to ComfyQQE_Puts, BUY_TO_OPEN.

"ComfyQQE_Puts, BUY_TO_OPEN" is what my scan is called in ToS

regholl commented 2 years ago

bot1 mine reads as 'MyBOTStrategyBUY' as my scan bot2 i'm deleting the SELL BOT

mogden16 commented 2 years ago

You're having an issue on the bootup... Your turn_on_times may be wrong. You have something similar to this? Make sure you RUN_BACKTEST_TIME = "01:00:00" or some time before market open. Also, make sure you pulled the most recent git from the master branch. I know it previously ran into an error with those things. image

mogden16 commented 2 years ago

Boot up should look like this between TURN_ON_TIME and SHUTDOWN_TIME image

regholl commented 2 years ago

yep thats exactly the way mine looks.i just cant get the bot to read the emails.it looks at it then deletes it

mogden16 commented 2 years ago

RUN_GMAIL = True? It might be smart to print out trade_alerts on line 376 of main.py to see if it's picking up any alerts. If it doesn't find any, then it must be something in the get_alerts method image

regholl commented 2 years ago

ok,i'll look into that but i just pulled an all nighter writing a whole new bot..it sort of a hybrid between yours and trey thomas.i need to at least get an hour of sleep before they ring the bell

regholl commented 2 years ago

2022-05-09T18:02:26.964 [ERROR] reginald holland - **256 - Traceback (most recent call last): File "e:\TradierTDA_Trader\assets\exception_handler.py", line 14, in wrapper return func(self, *args, **kwargs) File "e:\TradierTDA_Trader\assets\tasks.py", line 400, in killQueueOrder queue_orders = self.mongo.queue.find( AttributeError: 'MongoDB' object has no attribute 'queue'

this is what happens when the email comes in.not sure why its saying this but there is a queue because i manually put it in and im looking at it

mogden16 commented 2 years ago

So this could be because of a few reasons.

  1. In mongo -> __init.py -> is there this line? Make sure your "queue" you manually created is typed this way... it's case sensitive image
mogden16 commented 2 years ago
  1. Make sure it looks like this in mongo image

  2. If it's still not working, your mongo URI might be wrong in config.py

regholl commented 2 years ago

this is my mongo URI ,im using cluster0 dont know if that makes a difference

mongodb+srv://XXXXXXXXXXX:XXXXXXXX@cluster0.txkrb.mongodb.net/Api_Trader?retryWrites=true&w=majority

regholl commented 2 years ago

i must be the only idiot left that still has this prob glem ,AAAARGGGGGGH!!!!