crapher / medium Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Hello Diego,
First of all thank you for creating a very nice learning environment ! I've started going through your Medium posts from the beginning, but I'm running into some problems with OpenAI's gym in sections 3, 4, and 5. When I run the code (using python3.11) I get :
./medium/venv/lib/python3.11/site-packages/stable_baselines3/common/vec_env/patch_gym.py:49: UserWarning: You provided an OpenAI Gym environment. We strongly recommend transitioning to Gymnasium environments. Stable-Baselines3 is automatically wrapping your environments in a compatibility layer, which could potentially cause issues.
And in fact it fails to run. I tried simply replacing "gym" with "gymnasium" in your code, but maybe that was a little too optimistic (it doesn't work either without further modifications). I suspect that this is all because I'm using different versions of the various packages than you used when you wrote the code. As such it could be helpful if you can include information somewhere about what python and package versions this has been tested with.
Rasmus
Hello Diego,
First of all thanks for the work you have done regarding the options backtesting (11.OptionsBacktest) as explained earlier on the Medium Platform in your article called "SPY Options Trading with a Profitable 1-Minute Strategy to Multiply Returns and Limit Risk". Later on I saw you extended your work to QQQ and AAPL as well. Super cool !
I'm a data enthusiast and stock market watcher as well, and I replayed and reviewed your code, trying to understand the rules you applied to trigger a new trade or close one. The code you have written is somewhat hard to interpret as it has not been fully commented out. One example would be this line: df.loc[:,'open_point'] = np.where((df['open_point'] - df['close_point']) == (df['open_point'].shift(-1) - df['close_point'].shift(-1)), 0, df['open_point'])
It looks like the code is comparing rows in order to flag them as a possible trade (or not). But the 'why' is not clear to me.
So a short explanation of the steps would be helpful.
One other thing that I could not figure out was the meaning of 'POO' (percentage over price). What is that all about?
Last remark I would make is that I am also intrigued by the posts of Michael Petryni. To me it looks like he is trading in the following manner:
If you have no problem with it I would like to use one of your option data files to code his scenario and see what it brings. Would you be oke with me using your options data file ?
Regards, Nick
In your code for "How I Achieved Almost 85% Win Rate Using 0DTE Options and the Credit Spread Strategy on QQQ", I see you're using data which having some columns such as expire_date, kind, strike, open_underlying,close_underlying. Could you please give me how to have these columns?
Hi Diego,
Thank you for sharing.
I'm a little stuck and would really appreciate your advice.
The code runs at 10.30 and I get the following message:
INFO:root:Sleeping for 23:53:18 (Checking @ 2024-01-03 10:30:00-05:00)
Q1. Any time I run the code it goes to sleep again after a couple of minutes until the next day.
My understanding is the code is designed to run at 10.30 to examine the first hour of trading but I thought it would continue to run until the end of the trading day. Please advise.
Q2. Why 10.30?
Q3. Finally, have you tested this strategy on other stocks or ETFs?
Thank you,
Kieran
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.