Coding a Python Stock Trading bot with Alpaca

  Рет қаралды 44,874

Jacob Amaral

Jacob Amaral

Күн бұрын

Пікірлер: 128
@dw4_
@dw4_ 4 жыл бұрын
Would you mind zooming in on visual studio as it’s difficult to read on mobile
@Luvkeez
@Luvkeez 4 жыл бұрын
why are you even on mobile?
@dw4_
@dw4_ 4 жыл бұрын
@@Luvkeez I wasn't at my pc at the time. Also considering that 70% of KZbin views are on mobile, why are you watching on a PC?
@nepik1980
@nepik1980 4 жыл бұрын
Can you do a tutorial for Backtrader with Alpaca?
@evya5
@evya5 3 жыл бұрын
Can you make an updated video for using v2.0 of Alpaca API ? Now They have market data of their own
@shally1998
@shally1998 4 жыл бұрын
Would you mind showing/updating the git repository with your favourite answers to the TODO fir taking a profit?
@rubenmartikyan9266
@rubenmartikyan9266 4 жыл бұрын
I was the one suggesting to make the bot in python in one of your first videos. Thank you a lot it is really informative video.
@wenkaiyang1487
@wenkaiyang1487 4 жыл бұрын
You only show the coding part but can you show us how it works ? What does it look like ?
@ifeanyiiwuaba2761
@ifeanyiiwuaba2761 2 жыл бұрын
Any chance you can start zoom in on your codes. It is hard to see sometimes
@jacobamaral
@jacobamaral 2 жыл бұрын
Agreed, this an older video of mine so I do apologize. I always zoom in better now.
@ccr6942
@ccr6942 Жыл бұрын
Can Alpaca be used to scan the stocks too? I am talking custom coded scans not pre-made scans like trade ideas.
@pckcentral
@pckcentral 3 жыл бұрын
hey jacob you sent me cs file but some how I can,t use it my ninja scipt editor not recognize it.
@MrYega-zq7rz
@MrYega-zq7rz 3 жыл бұрын
What keys go at the polygon section? The API for polygon?
@NONAM3319
@NONAM3319 4 жыл бұрын
Thank you sir, you are a different breed and you will get far in life. I am loving this video and you have gained a subscriber. This is exactly what I was looking for (Just started learning programming and python). I am looking forward for more content.
@landondepaul3491
@landondepaul3491 2 жыл бұрын
how did you get tools and analyze at the top of VScode
@joshlazor6208
@joshlazor6208 4 жыл бұрын
Hey Jacob, I don't think that the bot would work if our capital is under 25k because of the PDT rule. Do you know how to get around this while creating an actual trading bot?
@jluisb2326
@jluisb2326 4 жыл бұрын
@Google User The Pattern Day Trader (PDT) Rule requires any margin account identified as a “Pattern Day Trader” to maintain a minimum of $25,000 in account equity, in order to day trade. ... Customers that are classified as a pattern day trader are required to maintain minimum of $25,000 in account equity in a margin account.The most common ways people day trade with less than $25,000 are: Using an offshore broker who is not bound by the PDT rule Using a cash account rather than a margin account Using a margin account, but staying at 3 trades or less within each 5 day period A combination of the above options- using both a cash and margin account Trading futures or options which are not bound by the PDT rule
@TheLuckycharms125
@TheLuckycharms125 4 жыл бұрын
@@jluisb2326 ​ Jacob Amaral Guys, Would NinjaTrader be an option to avoid the PDT rule even though I'm in the U.S? Because I normally use TD Ameritrade and Robinhood. But those both will make a trading bot impossible to use unless I have $25k saved. And i don't want to wait until then. Basically , Any ideas on what to use for bot trading and also being able to avoid the PDT while in the U.S?
@jluisb2326
@jluisb2326 4 жыл бұрын
Taylorjmedia: Hi Taylor unfortunately any trading platform ( Brokerage)in the US you need 25k, but the best small account will CMEG. CMEG offers two $2.95 trades which is cheap compared is offered by competitors. Individuals who want to open an account with this offshore broker need at least $500 minimum for 4:1 margin. Clients get a 6:1 margin for anything that is above $2500. CMEG charges a fee of $150 per month for its software, which may be a little expensive for some people. Nonetheless, Capital Markets Elite Group is the way to go if you are looking to trade stocks on margin with a small account. Im sorry unfortunately they don’t have a API developer access to create a bot app. You could start small trading option and future into you get 25k and transfer it to account to day trade stocks.
@waynefilkins8394
@waynefilkins8394 4 жыл бұрын
So how would someone run an indicator on all stock tickers? Or at least a shitload like 1000 of them? Do you have to sit there and type them all in and create a loop or something? Or does Alpaca have like a more advanced script for stuff like that?
@waynefilkins8394
@waynefilkins8394 4 жыл бұрын
I have a really good strategy it took me going on 3 years to create it and it's finally working but I have to sit there and go through all these damn stocks every morning to find the opportunities so I want to automate it with Alpaca. I played around with it before but not sure if it's capable of something that trades on several tickers and keeps track of funds and everything. If I can get this shit running right it's going to be huge. It's going to make crazy money over a year or 2.
@daguchful
@daguchful 4 жыл бұрын
can you do a video on a python trading bot that incorporates ml?
@dimayasnohurskyi2805
@dimayasnohurskyi2805 4 жыл бұрын
you can't use it on paper without funding account because polygon.io not allows it.
@ramseyhayek8852
@ramseyhayek8852 4 жыл бұрын
Can you make a video on using the fibonacci sequence with python? Thank you!
@josephthorpe3903
@josephthorpe3903 2 жыл бұрын
Hey love the video! Any idea how to solve the issue of cannot import name 'StreamConn' from 'alpaca_trade_api' (/Users/joethorpe/opt/anaconda3/lib/python3.8/site-packages/alpaca_trade_api/__init__.py) which originates from line 2. Weirdly line 1 runs (import alpaca_trade_api as tradeapi), but then line 2 has an import error?
@joshlazor6208
@joshlazor6208 4 жыл бұрын
Also, one more thing. Is there another database like Polygon? They charge 199$ a month, which is above my budget.
@tisisonlytemporary
@tisisonlytemporary 4 жыл бұрын
@@jacobamaral FYI Polygon's intraday data may have some inaccuracies. but yeah, alpaca's polygon request is a great start for no cost.
@WillTesler
@WillTesler 4 жыл бұрын
Polygon is free with Alpaca
@joshlazor6208
@joshlazor6208 4 жыл бұрын
@@WillTesler Is it really free with Alpaca? I thought it costed a monthly premium?
@joshlazor6208
@joshlazor6208 4 жыл бұрын
@@WillTesler How do you get it for free? (Do you know any videos on getting Alpaca to work with Polygon?)
@WillTesler
@WillTesler 4 жыл бұрын
@@joshlazor6208 As long as you fund your Alpaca account ($5 will do), you can use your Alpaca Key to access Polygon APIs. Look at the Alpaca docs about Data.
@omegasigma4500
@omegasigma4500 4 жыл бұрын
What do you think about QuantConnect?
@Contractedharry
@Contractedharry 3 жыл бұрын
Where and how do you connect the bots that you build? Thx
@jariel6512
@jariel6512 4 жыл бұрын
Would I be able to this out of a different IDE? Say Jupyter Notebook?
@mochilata
@mochilata 4 жыл бұрын
The overlay looks great. How did you set that up? Green screen and OBS?
@dipakkumarbera2131
@dipakkumarbera2131 4 жыл бұрын
Hi, can you build indian stock market trading bot. Or Algo trading bridge?
@biagiobrattoli791
@biagiobrattoli791 4 жыл бұрын
Thank you for the alpaca intro! Two questions: 1. could you compare it with Quantopian and compare them for us? 2. On a very different note, how is the ninja trader algo going? Are you profitable? I ask because I am very interested in starting algo day trading with python, but I have very different info from the Web, some say that day trading is awesome, others that it's just a huge scam. Since you have some recent experience and are not selling me your supercool 1-step strategy to get rich, I can trust your input :D
@phoque6
@phoque6 4 жыл бұрын
trying this out bu ti keep getting authentication error from Alpaca although i have signed up for API keys. Ivalid Alpaca API credentials message. I have created a new app under alpaca API create a new pair of client id and secret keys. Thanks
@weisun6621
@weisun6621 4 жыл бұрын
By the way, I heard polygon data has a lot of mistakes, which can not be counted for real time trading.
@chrisstokes2775
@chrisstokes2775 4 жыл бұрын
is it possible to buy and sell fractional share with the robinhood bots and how?
@xandro9928
@xandro9928 4 жыл бұрын
How do you bring up the chart with trading view on alpaca?
@Billonator117
@Billonator117 4 жыл бұрын
What are the day trading laws around this?
@code_ho
@code_ho 4 жыл бұрын
I tried many algos last month and most of them didnt work . And I notice most of the stocks/index/etf has different indicators that you could rely on. Im still looking for more resources and combination of algorithm for forecasting. fbprophet doesnt work either.
@vishalkukade4718
@vishalkukade4718 4 жыл бұрын
Hiii jacobe I am student who learn python machine learning and data science.,,, I want to make live website stock price prediction web app in python. Can you guide me how to start and where. What is the step by step process to implement this project
@rantg
@rantg 3 жыл бұрын
its really cool ! would you trust Aplaca enough to put there more than 10k ?
@nefibernal6113
@nefibernal6113 4 жыл бұрын
Hello i was wondering if you would consider creating a bot to TD Ameritrade, not sure if it is available in Canada if it is not, i would be happy to open and fund a test account
@tiandeqiang
@tiandeqiang 4 жыл бұрын
can you do backtest this strategy,i want see long time result
@mohammedalmuqwishi
@mohammedalmuqwishi 4 жыл бұрын
Hi Jacob, May I know what's the name of your data feed provider do you use? Thanks
@sychikdenis4779
@sychikdenis4779 4 жыл бұрын
There is written "Alpaca Data API provides websocket streaming for trades, quotes and minute bars" on alpaca website, but you mentioned that alpaca doesn't provide market streaming. So I'm confused. Could you clarify this? Thx
@phantomx7437
@phantomx7437 4 жыл бұрын
This is probably because of my WIFI because the signup is not loading for me, but your tutorial really helped me out I had to do this for a project and this really helped, Thanks!
@DeltaDoubleZero
@DeltaDoubleZero 4 жыл бұрын
so is this the same way for your robinhood and webull bot? and izm very new to this. any recommandation on how to get started with programing? XD
@k.j.9977
@k.j.9977 4 жыл бұрын
I saw that you have made a few bots. The question I had is: is it possible to create a betting bot for combined bets and for that bot to be as close to natural human activity.
@thedriftlessverse7121
@thedriftlessverse7121 4 жыл бұрын
Can this be setup to use something other than polygon.io? Like IEX Cloud instead?
@Boolap1337
@Boolap1337 4 жыл бұрын
Do you prefer Alpaca or Ninjatrader?
@jariel6512
@jariel6512 4 жыл бұрын
@@jacobamaral Why?
@13joar
@13joar 4 жыл бұрын
Hi! So I've a question regarding the choice of stock. Superimpose i want to check a whole segment of stocks, how can i implement all those? What you did was to only check for Microsoft MSFT. Any ideas how I can get the bot to check more than one stock?
@13joar
@13joar 4 жыл бұрын
@@jacobamaral Thank you for the response! If you would've changed the program to scan through more than one stock, what would you use? Personally, I believe the price seems more like the way to go to filter the desired stocks?
@wonjaehwang7670
@wonjaehwang7670 4 жыл бұрын
What keyboard do you use? Cherry blue?
@derek2d
@derek2d 4 жыл бұрын
Can you make a video on TD Ameritrade's ThinkorSwim platform? I have code that I use with think script but Idk how to use it with a bot. Thanks!
@pansyjoe5595
@pansyjoe5595 4 жыл бұрын
Instead of using streamconn for market data, do you see anything wrong with using alpha_vantage for that and alpaca api for making trades?
@288urvish
@288urvish 4 жыл бұрын
Great Video! Just have one question. I am getting an error when I try to run the program. The error says "Streamconn" object is not callable. Any solutions for that?
@waynefilkins8394
@waynefilkins8394 4 жыл бұрын
i cannot get this shit to work man. It's giving me this error but i know the codes are right: {"code":40110000,"message":"access key verification failed : access key not found (Code = 40110000)"} It says something wher eyou can set them using environment variables but i don't see why they over complicate all this shit can't I just put them in my code??
@rakumarudu
@rakumarudu 4 жыл бұрын
Are the real-time quotes through Alpaca free or do we have to pay money. The reason I ask is because polygon charges 200$/month
@shauncs
@shauncs 4 жыл бұрын
Hi Jacob, while trading bot active, do you have to keep $25k deposit in the bank account? For day trading?
@GottaBeGeek
@GottaBeGeek 4 жыл бұрын
Bro, I love the overlay with you. That's dope.
@toxicpenguin5167
@toxicpenguin5167 4 жыл бұрын
Also please show a vid on how your python bot performs? Thanks in advance
@Phil1053Locket
@Phil1053Locket 4 жыл бұрын
Shain Gardiner please this
@toxicpenguin5167
@toxicpenguin5167 4 жыл бұрын
@@Phil1053Locket pardon bud?
@Phil1053Locket
@Phil1053Locket 4 жыл бұрын
Shain Gardiner I am merely agreeing with you by saying “please this” so when he sees your comment and my reply he knows I also would like to see this.
@toxicpenguin5167
@toxicpenguin5167 4 жыл бұрын
@@Phil1053Locket ah sorry brother misunderstood... Just making sure what you meant
@Phil1053Locket
@Phil1053Locket 4 жыл бұрын
Vlad Charnine I mean he records his bot that he personally uses, live trading, earlier in his channel. So I’m not sure what you’re getting at
@weisun6621
@weisun6621 4 жыл бұрын
Hey Jacob, I have beening watching your trading bot videos - great job in explaining. Based on your experience, which one is the best among Alpaca, IB, polygon, in terms of real time market data accuracy. I am testing IB gateway API, but seems it only provide up to 1000 data point for historical data per request. Do you have sample code to get more market data, say a year's OHLC, and volume, with each bar as 1-minute? Alpaca allows you to specify start time so you can do for-loop to get all data you want, but seem IB gateway does not have that option in market data endpoint. Do you have experience on this issue?? I would appreciate it very much if you can shed some light. Thanks a lot!
@weisun6621
@weisun6621 4 жыл бұрын
@@jacobamaral Man, thanks for your quick reply. I am not using IB TWS API which requires to have TWS running which is too heavy. I am using IB Gateway which is a web api. Check here: interactivebrokers.github.io/cpwebapi/ and here: www1.interactivebrokers.com/api/doc.html#tag/Market-Data/paths/~1iserver~1marketdata~1history/get , its market data method does not have start time as argument. IB gateway is a light weight API that is way I like it and my purpose is to just get real time and historical market data (1-minute bars). I have pro account with IB. Unfortunately IB does not have good documents for this gateway API.
@ibn-nafis3434
@ibn-nafis3434 4 жыл бұрын
Good job boss, can we link python algo code to ninjatrader via API? thanks
@toxicpenguin5167
@toxicpenguin5167 4 жыл бұрын
Thanks alot for the python bot... Please if you tweak it please upload it on here...
@toxicpenguin5167
@toxicpenguin5167 4 жыл бұрын
@@jacobamaral when i improve my coding skills i can always do some projects for you?
@taylorcaldwell8277
@taylorcaldwell8277 4 жыл бұрын
Awesome videos man. I'm learning a lot. Could you maybe do a video on creating a more intermediate/advanced trading strategy with Ninjatrader and C#? The 5 video series you did on that platform was awesome but it would be cool to see how you'd approach a slightly more advanced strategy. I personally would write C# all day over Python lol.
@tribo327
@tribo327 4 жыл бұрын
Love the video, thanks! I have a few questions about your code that confuse me. 1. Where does the on_minute function specific to run every minute? 2. What is the variable 'channel' doing? I'm from an engineering background so I apologise if these are stupid questions!
@nickmoreno1332
@nickmoreno1332 4 жыл бұрын
Enjoyed this video alot! Keep them coming.
@lineage13
@lineage13 4 жыл бұрын
Au3 is so much more productive than Python. That cap sensitivity really hampers my productivity....
@byunjins
@byunjins 4 жыл бұрын
Hello Jacob, thank you for amazing video! I look forward watching your videos more. I have a question regarding about the alpaca. How do you connect to your broker like Robinhood? Does the alpaca have its own broker so that when you use submit order API it is ordered through alpaca?
@pierlucadepalma4803
@pierlucadepalma4803 4 жыл бұрын
Great video, we have a new algorithm that seems to guarantee 5% weekly (in 14w +140%). But we can't find a provider like Alpaca for real trading for non-US citizens. Do you know providers that are also open to non-US citizens? Thanks, P.
@alakayanand8555
@alakayanand8555 4 жыл бұрын
Yea man i do know alot of them
@alakayanand8555
@alakayanand8555 4 жыл бұрын
Which country are you looking for?
@pierlucadepalma4803
@pierlucadepalma4803 4 жыл бұрын
@@alakayanand8555 Italy
@pierlucadepalma4803
@pierlucadepalma4803 4 жыл бұрын
@@alakayanand8555 would you be interested in trying our algorithm?
@alakayanand8555
@alakayanand8555 4 жыл бұрын
@@pierlucadepalma4803 i think i may have a business oppurtunity for you
@nj-bz8pv
@nj-bz8pv 3 жыл бұрын
Thanks man! These are very helpful
@kingscreed1511
@kingscreed1511 3 жыл бұрын
Me: took a Python coding class 3 yrs ago. Also me: “Ive got this”
@Boolap1337
@Boolap1337 4 жыл бұрын
Its time to make a bot for the FX industry! :)
@aartisingh2573
@aartisingh2573 4 жыл бұрын
Please starting zooming your desktop
@IamJules
@IamJules 4 жыл бұрын
Your keyboard is so loud 😂 Sounds like an old typing machine
@egillis214
@egillis214 4 жыл бұрын
You need $25K to avoid PDT rules... Even to buy and sell 1 share in the same trading session.
@WillTesler
@WillTesler 4 жыл бұрын
Nice video. You should return with results. Also, consider a bracket order so you can set a take-profit and stop-loss all at once
@yashsri1
@yashsri1 4 жыл бұрын
Awesome tut. Thank you!
@ibn-nafis3434
@ibn-nafis3434 4 жыл бұрын
The right place for algotrader ,
@salvadorceja9087
@salvadorceja9087 4 жыл бұрын
You should do a crypto currency bot ?
@AmitCohenza
@AmitCohenza 4 жыл бұрын
Awesome content but what's the point teaching Python if you don't show the code?
@vhcxhbvg
@vhcxhbvg 4 жыл бұрын
I have a question. I'm at work rn so I can't watch. Can this trade real stocks not paper? I was wanting to make a project using c# to buy and sell stocks using if statements. Like, if BYND goes below 100 buy 5 if it goes below 99 buy 6. If it goes above 140 sell all. Thanks so much, I'm a new subscriber and this is exactly what I need in my life right now
@chriswang198
@chriswang198 4 жыл бұрын
Thanks Jacob! Really helpful video
@NoName40460
@NoName40460 4 жыл бұрын
I've waiting all my life for this moment 😭
@QUANT_Trader88
@QUANT_Trader88 4 жыл бұрын
A lot of people isn't teaching this at all
@growleym504
@growleym504 4 жыл бұрын
Visual Studio? LOL! Much easier on a Linux system. Plus the viewer doesn't have to go out and buy a WinDOHs system or a license, and Visual Studio, and operate in a very closed universe. Thumb down, couldn't finish watching this. Serious python coding calls for a POSIX based operating system even though yeah, in theory the OS doesn't matter. The fact is, well, never mind. I don't want to write a book here. But do this in Linux and you have a lot more flexibility and the whole thing is crazy simple. Just you and your code. Bam. I has spoken.
@bigpiggy8157
@bigpiggy8157 4 жыл бұрын
This is awesome! Still, if you find the coding side of it a bit intimidating you can try checking out Tradeoshi Labs their discord is here: discord.gg/UHcBgZ9 they are launching into BETA this for building without coding you can stack and loop up to 130 indicators from a GUI.
@phantomsedge5686
@phantomsedge5686 5 ай бұрын
kiss me
@jacobamaral
@jacobamaral 5 ай бұрын
I'll think about it.
I Tried Day Trading w/ a Trading Bot Algorithm
14:01
Daniel Inskeep
Рет қаралды 950 М.
Node.js: The Documentary | An origin story
1:02:49
Honeypot
Рет қаралды 682 М.
I Built a Trading Bot with ChatGPT
18:33
Siraj Raval
Рет қаралды 1,9 МЛН
Alpaca API, PostgreSQL, and TimescaleDB
20:04
Part Time Larry
Рет қаралды 13 М.
Why OCaml
1:06:40
Jane Street
Рет қаралды 124 М.
How To Build A Trading Bot In Python
18:46
CodeTrading
Рет қаралды 850 М.
Data Analysis with Python for Excel Users - Full Course
3:57:46
freeCodeCamp.org
Рет қаралды 3,4 МЛН
Algorithmic Trading Strategy Using MACD & Python
30:38
Computer Science (compsci112358)
Рет қаралды 174 М.
I Built A Crypto Trading Bot And Gave It $1000 To Trade!
10:25
Hallden
Рет қаралды 1,2 МЛН