How To Download Financial Data for Forex, Stocks, and Metals

Kurze Zusammenfassung

Dieses Video zeigt zwei einfache und kostenlose Methoden zum Herunterladen von Finanzdaten für Trading und Backtesting. Die erste Methode verwendet Python und die YFinance-Bibliothek, während die zweite Methode die Dukascopy-Plattform mit einem kostenlosen Konto nutzt, die Zugriff auf eine Vielzahl von Daten bietet, darunter Forex, Metalle, Aktien und Futures.

  • Python mit YFinance für direkten Datenabruf.
  • Dukascopy Plattform für eine breite Palette von Finanzinstrumenten.

Einführung in Finanzdatenquellen

Das Video behandelt zwei kostenlose Methoden zum Herunterladen von Finanzdaten, die für Trading und Backtesting verwendet werden können. Die erste Methode verwendet Python-Code mit der YFinance-Bibliothek, während die zweite Methode die Dukascopy-Plattform mit einem kostenlosen Konto nutzt. Dukascopy bietet Zugriff auf eine breite Palette von Daten, darunter Forex, Metalle, Aktien und Futures.

Kostenlose Finanzdaten mit yfinance in Python herunterladen

Um die YFinance-Bibliothek zu verwenden, muss diese zunächst mit pip install yfinance installiert werden. Nach der Installation kann die Bibliothek importiert und ein Ticker-Symbol (z. B. AAPL für Apple) angegeben werden. Mit der Funktion yf.Ticker wird ein Ticker-Objekt erstellt, und mit der history-Funktion können historische Daten heruntergeladen werden. Parameter wie Startdatum, Enddatum und Intervall (z. B. "1d" für täglich) können angegeben werden. Es gibt Einschränkungen bei den verfügbaren Zeitrahmen: Minutendaten sind nur für die letzten sieben Tage verfügbar, während stündliche Daten nur für die letzten 60 Tage verfügbar sind. YFinance ist kein offizielles Yahoo-Produkt und stützt sich auf Web Scraping, was bedeutet, dass die Daten möglicherweise nicht immer genau oder aktuell sind. Außerdem kann es Beschränkungen hinsichtlich der Anzahl der Abfragen geben, um eine Sperrung der IP-Adresse zu vermeiden.

Kostenlose Finanzdaten mit Dukascopy

Dukascopy ist eine Plattform, die kostenlosen Zugriff auf historische Finanzdaten bietet. Auf der Dukascopy-Website kann man unter "Historical Data Feed" verschiedene Daten auswählen, darunter Forex-Majors, Metalle, Aktien und Futures. Man kann das gewünschte Instrument (z. B. EUR/USD), den Zeitrahmen (z. B. vier Stunden), den Datentyp (Bid- oder Ask-Preis) sowie Start- und Enddatum auswählen. Es besteht auch die Möglichkeit, Wochenenden und Feiertage herauszufiltern. Nach der Auswahl der Parameter kann die Datei im CSV-Format heruntergeladen werden, wofür ein kostenloses Konto erforderlich ist.

Fasse jedes YouTube-Video in Sekunden zusammen

Hol dir Zusammenfassungen wie diese für jedes Video, in deiner Sprache, mit der kostenlosen Summ-App.

Laden im App Store
Jetzt bei Google Play

Transkript

Vollständiges Transkript von „How To Download Financial Data for Forex, Stocks, and Metals“. Klicke auf einen Zeitstempel, um das Video an dieser Stelle zu öffnen. Du brauchst ein anderes Video? Nutze den YouTube-Transkript-Generator.

0:00 today I will show you two free and simple methods that you can use to download financial data for your trading and strategyback testing in the first method we will use Python code and you can download the script from the link in the description below the second method is using the cascape platform with a free account where you can have free access to a large set of data that includes Forex Majors miners Metals stocks Futures and even more much more than we usually need for a back testing the reason I'm doing this video is the number of requests I'm getting regarding this topic many of you are asking me where do I get my data from so let's start with the first method which is the easiest straight from python make sure to install the Y Finance library before running this code by using the PIP install y Finance so the way I'm doing

0:46 this you can open a terminal in your code or in vs code and you can pip install it if you don't have a terminal you can also do this from within your Jupiter notebook just open a code cell you can type the exclamation and Mark then pip install y of Finance so I'm not going to run the cell I think if I run it it should show me that I already have installed the package yes so it's already satisfied and in your case it's going to install this then you can import y Finance just like any other library or any other package then we start by specifying the ticker symbol the stock you are interested in in this example I use the AAPL I think it's the Apple stocks as an example then we create a thicker object so this is done

1:34 using the Y finance.ticker function that takes as an argument the ticker symbol so it depends on which stock you want to download the data for then we can use the history function to download the historical data for that thicker symbol we specify the interval and some other parameters as you can see so we have the start date the end date and then the interval that we can see here so in this line line I'm downloading between the start and end date using the interval one day which means it's a daily time frame so to show you what this does I'm going to comment the second line that we're not going to use now I'm going to run this we can wait for the data to be downloaded and then we can print the data frame that's supposed to be

2:20 containing the data for the Apple between these two dates so it's 1990 up to 2022 that's a lot of data let's print this and we can see that we have 8315 rows now this means that we've just downloaded the Apple stock prices between the start and end date and we have 8 315 days of data because each row on The Daily time frame corresponds to one day and there's another way of doing this as you may have noticed the second line I'm going to command the first line in this case so instead of just specifying a start and end date I'm just going to put period I'm using the period parameter and the period here is equal to 20 days so what this does it's going

3:06 to download the let's say the hourly time frame for the last 20 days this is good if you want to stream live so if I want to download for example the last 20 days using the daily time frame I'm going to run this again the content of the historical data and we can see that we have we should have 20 days so I don't have the length here because it printed all the rows so I'm going to print the length of historical data and it should be equal to 20 and this is exactly what we have because we've just downloaded for the period of 20 days meaning the last 20 days and the interval is equal to one day so the time daily time frame we've just downloaded the last 20 days of data and this is all going into the data frame historical data that we can see here there are some

3:53 limitations that you should be aware of so the available time frames are one minute two minutes 5 15 30 90 minutes one hour one day five day and so on so up to three months however the one minute data so if you want to download data using the one minute time frame it's only retrievable for the last seven days you can't access anything except the last seven days and anything intraday so less than one day the hourly time frame 4 hours and so on this is only available for the last 60 days so if we try to download for example the one minute time frame so 1M or the last let's say eight days we usually should have an error and this

4:38 is what we can see here so one minute data is not available for start time with an index and end time with another index so the rest of the message showing only seven days worth of one minute granularity data are allowed to be fetched per request now if we start again using seven days it should work fine so that's what we have and the length is around 2664. remember that the Y Finance package will be cleaning the weekends and the days off so we only get candles or data where the market has movement now if we try uh the 15 minutes time frame for a longer period let's say 70 days and we execute this and we can

5:25 see that 15 minutes data is not available and let's see the limits the requested range must be within the last 60 days so if we decrease this to the last 60 days I think it's going to work and it worked so we can print the length of the data frame now so it's 1547. so this is for the 15 minutes time frame and I think the more you increase the time frame the more data you have access to so for example if we go back to one hour time frame and we print for the 60 days definitely we have access to this let's try and increase this to 120 days and it's still good maybe 320 days it's still okay I think it's somewhere around 700 the

6:10 limit or maybe we can just increase it to more than a thousand days and let why Finance tell us the limit so it's 730 days for the one hour time frame one more limitation of why finance that we should be aware of it's not an official Yahoo product so which means it relies on web scrapping and may not always provide accurate or up-to-date data and this is developed by a third party regarding the maintenance also we have no idea at some point if it's going to carry on or not another point to be aware of is that you are probably limited with a number of queries that you can use this for since this is relying on web scrapping approach so you might get your IP band if you are querying repetitively this means that it

6:57 shouldn't cause you any problems if you are just building strategies like this trying to back test and so on I mean if you query 10 20 or 100 times that's not a problem problem is if you build a bot and you're trying to query every minute many times continuously over 24 hours or so so this is probably going to be flagged by the system at some point anyway for the moment it's working a lot of Traders are using this and it works great for now we can enjoy it now I'll move on to the next method which is also as easy and it's free as well using the the cascape platform so dukascopy is uh US banking group that offers this platform for trading this video is not sponsored by them it just happens I'm using their service and it's for free to get the data so you can scroll down

7:45 their page and at some point there should be you should find this historical data feed so I'm going to click on this it's going to open this interface right here where you can select which data you you are interested in so we have the Forex we have the crosses the majors metals and so on you have Commodities indices bonds stocks anything you wish for I never needed anything that's not in this list for example we're going for Euro US dollars so I'm going to select Forex Majors Euro US dollar we're going to take this one and then we can choose the either the tick data or let's say the time frame I'm choosing our I'm downloading for

8:31 example now the four hours time frame you can choose is it the bid or the ask price that you want and the date the starting date and the end date we also have the option to filter Flats meaning weekends and days off so I'm disabling this I just like to keep all the data and then filter everything in Python day start time I usually use UTC time to GMT in order to have the universal time and the Precision could be millions or thousands then you simply press download and this is where you have to create an account it's for free there's no money to to create this account you can opt for the free option it's just that you need to have a login and password and once this is done you just click on the download

9:17 you sign in and you click on the download and you can get your file in a CSV format the file is being downloaded I just logged in so sometimes it gets stuck at fifty percent for a while downloading the file and then don't forget to click the save as dot CSV file so when we click this you will get the file in your browser or in your downloaded files this is it basically these are two free and very easy method where you can get historical data I usually also use a third method with my broker so you can stream live data from your broker if you want to query data more frequently so you don't get banned using Y Finance or any other methods but for back testing for the sake of back testing if you just want to have a CSV file or download the data frame to test

10:04 an idea of an indicator or a strategy on I think these two methods should be more than enough I hope this was helpful for you if so please like subscribe and support this channel until our next video trade safe and see you next time

Share

Weitere Video-Zusammenfassungen