The new version of mplfinance as of Feb 2020 allows this whole video to be done with 3 lines: import mplfinance as mpf df= pd.read_csv('IBM.csv',parse_dates=True, index_col=0) mpf.plot(df, type='candle', style='charles', title=' ', ylabel=' ', ylabel_lower=' ', figratio=(25,10), figscale=1, mav=50, volume=True )
@tcooper354 жыл бұрын
This line was needed in my run: import pandas as pd
@shayan58143 жыл бұрын
thank you
@irmscher96 жыл бұрын
Amazing!!! My hunters instincts turn on when I see candlesticks. Been coding my bots in cTrader, now I'm pretty sure I can make my own solution for backtesting and optimization with python! Been dreaming about it for ages, now you make my dreams come true! Myriads of thanks coming your way. :)
@PrakashPraaku6 жыл бұрын
Thanks a lot for this video series sir! Your knowledge sharing is priceless to me, they are helping me a lot. Thanks you so much sir.
@avgmean41874 жыл бұрын
FOR MATPLOTLIB FINANCE 2020: a) To install: pip install mplfinance #Conda still doesn't support a conda install so rely on pip b)To import: import mplfinance as mpf c) To plot: mpf.plot(your_df) d) To plot a candlestick chart: mpf.plot(your_ohlc_df, type='candle') #Now your index can be datetime type so no worrying about mdates and stuff
This series is really amazing, thank you! Well, i guess everyone here wants to make money xD
@lucasmolina51415 жыл бұрын
best youtube channel ever
@appliedstatistics20435 жыл бұрын
the matplotlib.finance module has been removed, we should use from mpl_finance import candlestick_ochl instead
@dino770g4 жыл бұрын
There is a NEW, easier to use VERSION of the matplotlib mplfinance package, with tutorials, that can be found here: pypi.org/project/mplfinance/
@daniellobo48354 жыл бұрын
thank you so much
@jameshuangmusic4 жыл бұрын
for those stuck on matplotlib.finance import; you need to pip install mplfinance (github.com/matplotlib/mplfinance) and use: "from mplfinance.original_flavor import candlestick_ohlc"
@EmmaNS173 жыл бұрын
THANK YOU!
@yu12rc5 жыл бұрын
From mdates documentation: "Matplotlib represents dates using floating point numbers specifying the number of days since 0001-01-01 UTC, plus 1. For example, 0001-01-01, 06:00 is 1.25, not 0.25. Values < 1, i.e. dates before 0001-01-01 UTC are not supported."
@xbjconan5 жыл бұрын
Hi @sentdex, I think there is one conceptual mistake in the video. When you do the 10 day candlestick summation (for high, low, open and close), you used each day's Adj Close as the source data. This is an easy way for showcase coding purposes and I do appreciate the simplified illustration in the video. :-) But in fact, 10-day candlestick summation should use the first day's "adj open"(not adj close) for the 10-day candlestick "open", and the max of each day's "high" (rather than max of each day's adj close) as 10-day "high". Similarly, the minimum of each day's "low"(not minimum of each day's Adj close) is the real 10-day candlestick low. Otherwise, we will never get the same identical candlestick to the ones showed on stock websites.
@xbjconan5 жыл бұрын
To update the code with this concept incorporated, replace the follow code in the tutorial: df_ohlc = df['Adj Close'].resample('10D').ohlc() with the following: ohlc_dict = { 'Open':'first', 'High':'max', 'Low':'min', 'Close': 'last', 'Volume': 'sum' } df_test = df.resample('w', closed='left', label='left').apply(ohlc_dict) df_ohlc = df_test[['Open','High','Low','Close']]
@TURROKS5 жыл бұрын
you can use mpl-finance as well, it does come with candlestick_ohlc
@djstr0b37 жыл бұрын
Awesome videos. I'm addicted already!
@NotSoNegative5 жыл бұрын
This is amazing. Thank you Sentdex!!!
@saltyspades74934 жыл бұрын
Hey @sentdex, thanks so much for the educational videos! In the beginning of the video, you talked about millisecond data and the likes. How would we get second data or even minute data? Thanks a bunch in advance!
@kenymac95 жыл бұрын
mpl-finance was deprecated in 2020, now you have to use mplfinance. To make 10 day ohlc chart you can use: df_ohlc = df['Adj Close'].resample('10D').ohlc() df_ohlc.rename(columns={'open': 'Open', 'high': 'High', 'low': 'Low', 'close': 'Close'}, inplace=True) print(df_ohlc.head()) # just to make sure rename worked mpf.plot(df_ohlc, type='candle') For some reason the .ohlc() function uses lower case column names but mpf.plot needs upper case names so just have to rename
@tee91205 жыл бұрын
i'm getting an error that says 'candlestick ohlc' is not defined, have tried installing and updating to mplfinance but still no luck... any ideas?
@JozoLeko4 жыл бұрын
Could you please send your file... or post it here
@weikaichen5464 жыл бұрын
Hi! Thank you so much for the informative tutorial! Really awesome! Do you know how to obtain the stock data with higher resolution in the time frame, e.g. stock ohlc in 15 minutes? The current data only have time frame of days, hence, we cannot really resample it to get 15min bars. Thanks a lot!
@Nico-rl4bo4 жыл бұрын
Nice thanks for the tutorials
@amirbasirat35854 жыл бұрын
Thanks a lot for your tutorials. I have a question about the candlestick chart. How can find the exact location of each candle in the chart like (x= ?, y= ?)?
@timperez45424 жыл бұрын
update! type "pip3 install mplfinance" instead since the mpl_finance is deprecated as per my research HAHA! You do not have to import 'candlestick_ohlc' anymore. 'mplfinance.plot()' defaults to ohlc style charts. "from mplfinance.original_flavor import candlestick_ohlc" if you want to follow the code also "from matplotlib.dates import date2num" still works!
@kadrogo6015 жыл бұрын
I start to watch your video and begin to learn so much. Thank you very much! And i have a question for resample's window. You used "10D" for resample window which means that the resample process is done for every 10 days. I was not sure these days are business ones or calendar ones.. So I adjusted 10D to 1D and the data expanded to have calendar days which are not included in the original data.. So the 10D is calendar date, is it?
@jonallen32796 жыл бұрын
for me it says 'mdates' is not defined ....?
@hannahtang50185 жыл бұрын
Why do I get "value error: not enough values to unpack" when plotting the candlestick chart? Everything works up till then and I followed each step exactly!
@tobywheeler71294 жыл бұрын
Make sure that you have ".ohlc()" on the end of this line: df_ohlc = df['Adj Close'].resample('10D').ohlc() I mistakenly had ".mean()" on the end and was getting the same error.
@mrcartier38598 жыл бұрын
Thanks for tutorial. I changed line 4 b/c of the warning below: MatplotlibDeprecationWarning: The finance module has been deprecated in mpl 2.0 and will be removed in mpl 2.2. Please use the module mpl_finance instead. My line 4 is now: from mpl_finance import candlestick_ohlc However when I try to do so I get - Import Error: No module named mpl_finance. Any ideas???
@TheGreatPanic8 жыл бұрын
What did you change it to?
@mrcartier38598 жыл бұрын
see above "My line 4 is now...."
@TheSBraun588 жыл бұрын
mpl_finance is available on github. I didn't find it on PyPi but you can download the module from github at github.com/matplotlib/mpl_finance.
@juanbarco928 жыл бұрын
after downloading the file what is the next step? Thank you for the answer :)
@simasjanusas17667 жыл бұрын
Check the version of your mpl. I bet it is lower than 2.0 and certainly below 2.2. If that's the case, the reasons is that your mpl version is older.
@epicwhat0015 жыл бұрын
This combines 2 things that I love(coding and Stocks) can't get enough of it. is it possible to get a hourly precision instead of daily precision of the data ?
@mortysmith76274 жыл бұрын
The resample function takes 10 days data and stores in under the 1st date of those 10 days. Shouldn't it be stored as the data for the last date of the 10 days?
@deadcatbouncefund3476 жыл бұрын
Amazing tutorial! Thank you for all this content. Your vids are helping a lot. Any idea how to replace candlesticks with bars though? Candlesticks are not something I am used to look at when charting.
@Rochbenritter8 жыл бұрын
Just the warning for the future: "MatplotlibDeprecationWarning: The finance module has been deprecated in mpl 2.0 and will be removed in mpl 2.2. Please use the module mpl_finance instead."
@juanbarco928 жыл бұрын
HI, Im really new on python, I also have the same warning but I don't know what to do in order to install the mpl_finance module. Any suggestion? Thank you
@o0prince7 жыл бұрын
I know its 4 months ago you should solved it by now, but for reference you do not have to change anything at the moment it will still work.
@litojonny7 жыл бұрын
for me: go to raw.githubusercontent.com/matplotlib/mpl_finance/master/mpl_finance.py copy the data go find finance.py in matplotlib delete everything in it replace it with the data from the link above ps~ it is still "from matplotlib.finance import candlestick_ohlc" or you could always just download mpl_finance and make a new mpl_finance.py
@KittyZCHEN7 жыл бұрын
My way: 1. go to raw.githubusercontent.com/matplotlib/mpl_finance/master/mpl_finance.py copy all the script, paste into a new .py, named whatever you like, such as "mpl_finance.py" or "finance.py", and save it 2. " import mpl_finance from finance import candlestick_ohlc" just import the module you saved in step 1. and you will get what you want at the end
@Zyl80787 жыл бұрын
As I understand, they will replace matplotlib.finance to matplotlib_finance right? If not what is the right name?
@azamat_kalam4 жыл бұрын
@sentdex I love your content!!! I am just curious where did you learn all this fin-tech stuff in the beginning, programming communities, some courses, or just googled everything?
@michal.nalevanko8 жыл бұрын
Hello, is this idea of resampling usable when you want to change the series of daily stock prices to a weekly timeframe? Or would it require another approach? Perhaps you could address this issue in some of your future videos. Thanks a lot!
@sentdex8 жыл бұрын
That's exactly what resampling can do for you! .resample(1w) i believe is the syntax, but you can check docs.
@sabyabhoi88415 жыл бұрын
hey there, I've observed that you resampled the Adj Close column of the df instead of resampling the entire dataframe. I know that both cases yield different results, but what EXACTLY is that difference??
@harshalkulat79975 жыл бұрын
@sentdex please make tutorials using updated libraries like mplfinance 😊
@chiradip247 жыл бұрын
Great job sentdex.. i just love your tutorials.Keep up the good work. All those getting warnings on Finance module deprication, pl download the mpl-finance module from this link github.com/matplotlib/mpl_finance. Extract the file to a folder, then just type in cmd : pip install < path to the folder> Eg: pip install D:\mpl_finance-master ( This was what i did) then check with pip freeze, and import module as mpl_finance
@garrydu39367 жыл бұрын
Resampling OHLC from a 'adj close' data will give the true max price achieved in the 10 days? Same as the min price, or open? I think open for the 10 days candle should be the open price of the first day of the 10 days. Using 'adj close' to resample 'open' will give this open price?
@ToT-teacherofthings6 жыл бұрын
Thank you so much 😊 it was super helpful
@alexanderantunez71804 жыл бұрын
What i did was: pip install mpl_finance (on Anaconda Prompt) import mpl_finance (on Spyder) from mpl_finance import candlestick_ohlc (on Spyder) Worked for me.
@kingsleymunu70316 жыл бұрын
I keep on getting TypeError: map() takes 2 positional arguments but 4 were given. Anyone knows why? Thank you.
I don't like the empty gaps between the candlestick plot, where there was no value, is there any way to make the gap disappear?
@sentdex8 жыл бұрын
You can google this. It's not super simple, but there are lots of examples of people eliminating the weekend/holiday gaps.
@markd9646 жыл бұрын
This seems to be an intricate problem, eliminating missing data gaps on daily data, for example. Have google and tried coding everything on this, but still cannot resolve. If there was any solution you can offer, hugely appreciated - thx
@saraswathishanmugamoorthy23576 жыл бұрын
sentdex Can you please do a tutorial for installing mpl_finance, I've been searching for 4 hours. Matplotlib finance isn't working. Thanks in advance
@MrQuenonoscaguen6 жыл бұрын
Try with pip install github.com/matplotlib/mpl_finance/archive/master.zip
@zo626 жыл бұрын
did you ever get this resolved?
@melorenzo12786 жыл бұрын
You can use this tut: stackoverflow.com/questions/42373104/since-matplotlib-finance-has-been-deprecated-how-can-i-use-the-new-mpl-finance
@chemhong8 жыл бұрын
Thanks sentdex~~~~ I have a question on plotting minutes ohlc, it has a gap, how can i remove the lunch time gap? thank you so much
@126trav4 жыл бұрын
Question: how can we adjust the scale of the second axis to reflect the actual volume values?
@erfantaghvaei39525 жыл бұрын
Hello Sentdex, one question after all these years of mastering and teaching Python, How do you see the language compared to other programming languages?
@heidizhang66574 жыл бұрын
Hi everyone-I have a question: why should we map the 'date' object to some doubles rather than directly use "date" when we plot the graph?
@handsomerobnj7 жыл бұрын
Have you noticed that Pandas' EMA (ewma) never matches the actual EMA? Compare it to historical EMAs for a ticker on MarketWatch... the 20-day EMA never matches no matter what parameters you use.
@matheusmota434 жыл бұрын
Hi guys! how to build an interactive chart? I followed the same steps as the video - except replacing matplotlib.finance for mplfinance, since the lib was deprecated - but I realized that I can't interact with my chart ... as if it were just a static image. Can someone help me please???
@Smutny12214 жыл бұрын
The resample function is kinda dumb, because it samples every 10 calendar days, instead of every 10 trading days, so you can have anywhere from 3 to 8 rows combined, so volume, range, price change etc. will be inaccurate
@ReactsRebirth8 жыл бұрын
Will you be continuing this to touch on trading (backtesting, WFT)? Great stuff by the way
@sentdex8 жыл бұрын
We'll definitely be getting into backtesting, as well as general research and development of a strategy in this series, which will mostly be taking place on Quantopian, though this next batch will still be off-quantopian so we can hopefully get a bit more comfortable dealing with stock data and pandas before we throw even more libraries at ourselves.
@ReactsRebirth8 жыл бұрын
Great! Looking forward to it. Anyway you would consider a series on moving from Quantopian to plain Python? We have an algorithmic trading team at our school and I'm eager to learn outside of Quantopian.
@sentdex8 жыл бұрын
If there exists a good dataset out there for free to both me and my viewers to play with, sure, I might cover taking something off of Quantopian, mainly for the purpose of deep learning. That said, I do not have a dataset that is really good enough for this purpose. Without having a need for high processing power, I don't see much point to not use Quantopian, since it's all Python there as well. their processing power is great for just about everything...except deep learning.
@ReactsRebirth8 жыл бұрын
Ah, understandable. Just curious, when do you expect the Quantopian series to begin/complete? How many episodes will there be, etc.
@Austin94358 жыл бұрын
First off! I love this series! love all the work you do. I have learned alot from you. Backtesting would be great. I am currently working on some backtesting myself with pandas. I do not live in the US so Quantopian for me is not something can use. So i second the request for seeing more backtesting (without Quantopian).
@vidishmehta90036 жыл бұрын
Hey guys, I am new to python. I am facing the following type error: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'Index'. Anyone here faced this problem and know how to work around it? Any help is greatly appreciated :))
@CyborgGaming996 жыл бұрын
Just add this line: df.index = pd.to_datetime(df.index, format='%Y/%m/%d')
@yodude3487 жыл бұрын
Hello, I am using jupyter notebook. It is not printing the candlestick charts however it is printing the moving average and adj close price charts. What could be the possible reasons for this and what is the solution? Thanks in advance.
@yashnaik1107956 жыл бұрын
did u find any solution?
@snowyhouse6 жыл бұрын
did you find any solution? would you like to share?
@Daniel-to5jd6 жыл бұрын
I use jupyter and it prints the candle chart without any problem
@jorgerios40916 жыл бұрын
Im using jupyter too and it printed the candlestick after a lot of lines like , ], [, just look at the bottom :)
@aprilmeng745 жыл бұрын
Dan hi I printed nothing using jupyter
@veNtzo7 жыл бұрын
When I plot the red for colordown don't show.. why is that? I have tried adding " colordown='r' " but it don't seem to do anything.. any suggestions?
@MrCrjuncher6 жыл бұрын
Had same issue, check if you imported candlestick_ochl instead of candlestick_ohlc. It was my issue.
@randyhouston16444 жыл бұрын
I got stuck on candlesticks no longer being supported as above. I did find a work around. I installed mplfinance (see-pypi.org/project/mplfinance/) and then found this replacement line to get it to work: from mplfinance.original_flavor import candlestick_ohlc Note: I am new to Python et al so maybe there is something flawed but this seems to work okay. Love the videos.
@likewoahdude234 жыл бұрын
worked amazingly! thanks
@ahmedb86137 жыл бұрын
Is there any way to bring out an interactive window when using the jupyter notebook? i just get a static graph that doesnt let me zoom in. Any suggestions? Great vids btw Sentdex idk how you find the time for it all!
@simonchan23947 жыл бұрын
Yes there is a way. Works great for me: stackoverflow.com/questions/10655217/ipython-notebook-pylab-inline-zooming-of-a-plot
@ahmedb86137 жыл бұрын
Simon Chan, you are a bloody legend mate. Thank you!
@AIvanTrue2 жыл бұрын
why ohlc manupulation is on Adj CLose not on anything else ?
@nousername50065 жыл бұрын
You will need to use mplfinance instead of matplotlib.finance or mpl_finance (matplotlib.finance is deprecated and mpl_finance is being deprecated in 2020): $ pip install mplfinance >> from mplfinance import candlestick_ohlc
@kim8u967 жыл бұрын
Sorry can anyone explain me why initially dates aren't a column, but an index? What does it mean that they are an index?
@simonchan23947 жыл бұрын
You might have forgotten a ax2.xaxis_date() in your video. When I ran your code, it displayed the mdates 700k date instead of the human readable date. After I added that piece of code, it converted itself back to Dec 16 etc. I also tried running the code without the mapping to the mdate part: ax2.fill_between(df_volume.index, df_volume.values, 0) and it worked successfully and showed the human readable dates, is there a reason why we convert it to mdates?
@NoName-ke4lq7 жыл бұрын
The code "ax2 = plt.subplot2grid((6, 1), (5, 0), rowspan=1, colspan=1, sharex=ax1)" You have to make sure that the "sharex=ax1" is included and working so the Volume Chart will be using the same date format with the ax1.
@beansgoya7 жыл бұрын
Thanks. I was confused about that as well. adding the sharex=ax1 worked for mw
@chiefbarkontree8 жыл бұрын
It appears as though you are calculating a mean of the adj close values and plotting an OHLC candlestick based on those 10 day mean values. Is that correct? What if I didn't care about adjusted prices and simply wanted to plot each day's OHLC values?
@Xyaran8 жыл бұрын
adj close values are not average, they are close values adjusted for split of the stock. In this case (TSLA) there hasn't been a split yet, so adj close is the same as close values. On the other hand, you still bring a good point asking for intra-day OHLC values. Right now, what we have is the OHLC Values of the close Values during that period. How would someone get the OHLC Values for Intra-Day variations? Thanks for the good tutorials, I really enjoy them! Eric
@chiefbarkontree8 жыл бұрын
Eric Lamontagne I understand exactly what adj close values are. But how exactly is he getting OHLC when combining prices for 10 days?
@Xyaran8 жыл бұрын
It only takes the Opening (first day) value of the Adj Close, the Highest Adj Close, etc... no averaging. But if the is an intra-day higher value, then it is NOT taken into account. Only values from Adj Close are used.
@chiefbarkontree8 жыл бұрын
Eric Lamontagne ok I understand but the problem with doing that is you can't make any significant inferences from the data by using only adjusted close values. Why didn't he just leave the daily OHLC data as it was? He really confused me with something I believe is completely unnecessary and practically useless. Just work with the daily OHLC data and don't alter it. I had a tough time completing the tutorial because I couldn't understand why he did that. Thanks for clearing this up btw
@eskade17 жыл бұрын
try something like this: ohlc_dict = { 'Open':'first', 'High':'max', 'Low':'min', 'Close': 'last', 'Volume': 'sum'} df_ohlc = df.resample('W', how = ohlc_dict)
@adityaagarwal42626 жыл бұрын
Can anyone explain how do to get the candlestick graph for the same day open high low close values instead of the 10 days close values as used here.? Thanks.
@nathandelara88796 жыл бұрын
when I tried following, my code always got flagged as something along the lines of No module named 'matplotlib.finance' no matter if i changed it to mpl_finance or not what can i do to fix
@rudivonstaden6 жыл бұрын
you have to first do 'pip install mpl_finance' to install the package before it will work in your code
@equalsfit56855 жыл бұрын
@@rudivonstaden thanks rudi, is this an alternative or an update? since the matplotlib.finance is being deprecated...
@johnhillescobar7 жыл бұрын
I used this approach to install mpl_finance: "Since mpl_finace is not on pip now, you may also want to use following command to install mpl_finance by pip: pip install github.com/matplotlib/mpl_finance/archive/master.zip" I found this info here: stackoverflow.com/questions/42373104/candlestick-ochl-graph
@BigOXander5 жыл бұрын
hi, just trying out this tutorial, and I get a small issue, my negative candlesticks aren't showing, any idea? but my greens are very nice
@DJSunnyParker8 жыл бұрын
I change the 10D to 1D and it just shows lines and not full candles. why is that?
@NoName-ke4lq7 жыл бұрын
That's because Candle's stick display High, Low, Close and Open data. That's why the structure of the Chart is a Candle Stick. When you put it as '1D', all the High, Low, Close and Open data will be the same Adjusted Closing price of that specific day. Therefore, it shows one line as all High, Low, Close and Open is the same Adjusted Closing Price.
@pawankumar7865 жыл бұрын
Love you brother
@dashawnlyons27914 жыл бұрын
I know this is an old video but what import method I use to create my candlestick graph on my python idle?
@EgorGordeev6 жыл бұрын
SOLUTION (for Anaconda): If you got a problem with installation of mpl_finance in Anaconda. Try to right click on the tickmark of package in Environments and select the appropriate version on matplotlib (as far as I remember must be under 2.0.0)
@andreaarcos89855 жыл бұрын
I have v3.0.2 and still that problem
@enish275 жыл бұрын
As for 'import matplotlib.dates as mdate', it should've been '. . .as mdates', right? otherwise, you will keep seeing error : 'mdates not defined.'
@0xsuperman5 жыл бұрын
I understand this is a demo, but in real life, do people create their own ohlc based on the aggregated adjusted price? I would have imagined it wouldn't be useful in real life stock trading? Please correct me otherwise.
@sentdex5 жыл бұрын
Yes, they do. It's a common way to condense granular data into a meaningful, yet smaller size.
@mmusk14695 жыл бұрын
The output is always NaN when a resampling timeframe is less than 1D. Did I miss something? Thanks
@kerdos66145 жыл бұрын
You only have everyday-data, so you cannot analyse it more than that I guess
@hummingbirdkitchen69163 жыл бұрын
I am getting different results while following same steps. Not sure why. I do see that data never reached as high as what's in the output being shown in the video in first 10 days based on first 10 rows of the the dataset. So I don't think the output being shown in the video is accurate - unless I am completely wrong!!!! df_ohlc = df['Adj Close'].resample('10D').ohlc() df_volume = df['Volume'].resample('10D').sum() print(df_ohlc.head()) open high low close Date 2010-06-29 4.778 4.778 3.160 3.492 2010-07-09 3.480 4.128 3.410 4.128 2010-07-19 4.382 4.382 4.044 4.144 2010-07-29 4.070 4.390 3.918 3.918 2010-08-08 3.920 3.920 3.520 3.830
@haraldsalvesen5676 жыл бұрын
I love you man
@coola29237 жыл бұрын
hi, i am getting an error while executing the code."NameError: name 'date2num' is not defined" Can you help?
@johnhillescobar7 жыл бұрын
What happened to you is that you did not reset the index as Harrison did.
@Locke199017 жыл бұрын
So Harrison, do you like mdates or not? >:)
@tee91205 жыл бұрын
This is probably a shout into the void but i'm getting an error that says 'candlestick_ohlc' is not defined. I have installed to the mplfinance just fine but the error still pops up, am I missing something?
@sentdex5 жыл бұрын
Did you forget to import it?
@tee91205 жыл бұрын
@@sentdex oh shit YOU replied. Perhaps I am having a complete brainfart but when I use "from mplfinance import candlestick_ohlc"... The error reads 'cannot import candlestick ohlc from mplfinance' I have made sure to pip install the necessary module and still no luck
@sentdex5 жыл бұрын
Hmm, looks like they've changed how things work. Now you import mplfinance as mpf, then do something like mpf.plot(daily,type='candle',mav=(3,6,9)) More info: github.com/matplotlib/mplfinance
@ramenpavlov40066 жыл бұрын
How do you keep the bars and not fill them in between?
@adimilstein70427 жыл бұрын
divide the matplotlib date by 365 and you will get the year we are in :)
@petersilva34225 жыл бұрын
quick question: how to run part (not all) of my script in eclipse (IDE)? I usually press F11 and runs ok, but it does for the entire script. How can I run just part of it?
@joannemvs_5 жыл бұрын
Comment out the other lines
@dino770g4 жыл бұрын
There is a NEW, easier to use VERSION of the matplotlib mplfinance package, with tutorials, that can be found here: pypi.org/project/mplfinance/
@jaxyang36495 жыл бұрын
Why my plots are not interactive as what are shown in the video? I am using Jupyter .
@xbjconan5 жыл бұрын
Jupyter will not have an interactive figure. You can try Pycharm
@yibeihe90265 жыл бұрын
Why my graph still shows number instead of actual dates on the x-axis? I'm using python on spyder.
@yibeihe90265 жыл бұрын
If I convert the dates to number, do I need to convert them back? I'm confused. Any help? Thank you!
@prasadkshatriya15145 жыл бұрын
Which Ide or editor you are using
@anudwaram18594 жыл бұрын
ModuleNotFoundError: No module named 'matplotlib.finance'- getting this error. Tried different ways. But still getting that error.
@jscutt7 жыл бұрын
For anybody that needs MPL FINANCE. Go here: github.com/matplotlib/mpl_finance then press "Clone or download". Extract to the default directory, then go "pip install C:\path to that directory"
@adamgdev4 жыл бұрын
If you are running anaconda, you will need to do a “pip install mplfinance” to get the module. Now check out what @Taobyby wrote below in the comments to import it.
@dolodestinations76284 жыл бұрын
i did these both and it still does not find the module. Even with the command prompt showing it has been downloaded. please advise.
@sherifmoussa48276 жыл бұрын
thank you
@shadeofthetrees7 жыл бұрын
random question, but what kind of keyboard did you use in this video?
@sentdex7 жыл бұрын
microsoft sidewinder x4
@rverm10004 жыл бұрын
I'm getting this ValueError: Input passed into argument " 'y1' " is not 1-dimentional
@matheushernandes42124 жыл бұрын
I had a similiar error, hope it helps you. I got the data from yahoo finance, not from a .csv file as in the video. Inside the DataReader('TSLA', 'yahoo', start, end) I tried to pass a list with only one ticker inside ['TSLA'] and got the error. Changed it to a string ticker = 'TSLA' instead of = ['TSLA']
@urieljanota4 жыл бұрын
i found an error in my code, with this line: "from matplotlib.finance import candlestick_ohlc" what maybe is happening ? Thanks
@StrikeStyles4 жыл бұрын
You may need to update your matplotlib.finance module pip install mpl_finance Instead of: from matplotlib.finance import candlestick_ohlc Try: from mpl_finance import candlestick_ohlc just copied from above
@urieljanota4 жыл бұрын
Thaaaaanks !!!!!!!!!!
@avikumar21165 жыл бұрын
can someone tell me when sentdex starts to predict stock price in this series.
@sentdex5 жыл бұрын
Dont think it ever happens.
@yasinbayat97164 жыл бұрын
Hi guys I have an error in python and it is "No module named 'matplotlib.date'" what should I do? I have also check in pip for updating even matplotlib but there is no module like this
@ДмитрийВоробей-с7ъ4 жыл бұрын
not date but .dates
@bradleythomas31937 жыл бұрын
Hey, how do I fix the "MatplotlibDeprecationWarning: The finance module has been deprecated in mpl 2.0 and will be removed in mpl 2.2. Please use the module mpl_finance instead." I have downloaded the module from github but down know how to install it. Would appreciate any help.
@sentdex7 жыл бұрын
does it have a setup.py? If so, extract the contents if they're compressed, navigate to the directory with the setup.py in command prompt/terminal, then do python setup.py install
@nj93626 жыл бұрын
did this, still not working
@MrThiteixeira6 жыл бұрын
Try this pip install github.com/matplotlib/mpl_finance/archive/master.zip
@markd9646 жыл бұрын
pip install mpl_finance
@Duxaization6 жыл бұрын
I keep getting this error when typing the first sheet of code. ModuleNotFoundError: No module named 'pandas_datareader' I have installed it numerous times, and it is still not working. Can I get some help me out please?
@snowyhouse6 жыл бұрын
sudo python3 -m pip install git+github.com/pydata/pandas-datareader I used the above to install and works for me
@tommoore91967 жыл бұрын
How can I do to have the volume in blue as in the video
@SkyRocket1594 жыл бұрын
We can do any number we woint
@kennyPAGC7 жыл бұрын
I didn't really get what the 0 does in the fill between graph
@simonchan23947 жыл бұрын
it just fills up the graph from 0 to the actual volume of the days in that the share was trading on. Try experimenting by putting instead of 0, like 1 000 000 000 and see what happens.
@zo626 жыл бұрын
any correction on mlp_finance I still seem I cannot install
@harshchaudhary73346 жыл бұрын
hey sentdex ,i am getting folllowing error ,please can you help Traceback (most recent call last): File "finance.py", line 28, in candlestick_ohlc(ax1, df_ohlc.values, width=2, colorup='g') File "/home/harsh/anaconda3/lib/python3.7/site-packages/mpl_finance.py", line 236, in candlestick_ohlc alpha=alpha, ochl=False) File "/home/harsh/anaconda3/lib/python3.7/site-packages/mpl_finance.py", line 302, in _candlestick xy=(t - OFFSET, lower), TypeError: unsupported operand type(s) for -: 'Timestamp' and 'float'
@mehmetadkalan23435 жыл бұрын
Why "Keyerror:'Adj Close'?thanks bro
@soonchungyap9856 жыл бұрын
To install, in command line, change directory to correct place (Eg. cd C:\Users.... \Python\Python37-32\Scripts): pip install mpl-finance refer to: pypi.org/project/mpl-finance/ Python code in text editor, import by: from mpl_finance import candlestick_ohlc refer to: matplotlib.org/api/finance_api.html
@Capitalust6 жыл бұрын
For anyone using mpl 2.2, mpl.finance does not exist anymore and is now mpl_finance. Go to terminal and enter: pip install github.com/matplotlib/mpl_finance/archive/master.zip
@fluctuating_coordinates65167 жыл бұрын
hi sentdex, Thanks for previous help. This line of code is not working. df_ohlc= df['Close'].resample('10D').ohlc File "C:\Program Files\Python35\lib\site-packages\pandas\core\generic.py", line 2360, in __getattr__ (type(self).__name__, name)) AttributeError: 'Series' object has no attribute 'ohlc' RSVP kushal