Downloading historical trading pair data on BINANCE using Matlab.
16 ビュー (過去 30 日間)
古いコメントを表示
Hi. I need to download the historical funding data for each of the crypto pairs from the Binance website https://www.binance.com/en/futures/funding-history/1 The trading pairs can be selected on the website, and then a download button already exists that allows for downloading the .csv file. I know this will probably be easier in python but I am not familiar with python. I basically just want to write a Matlab script that automatically selects one pair after another and then downloads the default amount of data similar to when you will manually click on the download button.
Any ideas would be appreciated.
1 件のコメント
Abolfazl Nejatian
2021 年 5 月 25 日
dear Jan,
did you find a way to put order in binance from the matlab platform?
回答 (1 件)
Satyam
2025 年 2 月 10 日
Hi there,
To download historical funding data using MATLAB, you can start by identifying the URL, request body, and options for the API call. Once you have those details, you can use the ‘webwrite’ function in MATLAB to specify the HTTP URL and the content as name-value pairs. For more information on how to use ‘webwrite’, you can check out the following MathWorks documentation https://www.mathworks.com/help/releases/R2021a/matlab/ref/webwrite.html
Additionally, you might need to include HTTP request options, which can be specified using the ‘weboptions’ object and passing it as an argument to the ‘webwrite’ function call. API calls often require the request body in JSON format, so you can use ‘jsonencode’ object to convert your data into JSON. More details on ‘jsonencode’ can be found: https://www.mathworks.com/help/releases/R2021a/matlab/ref/jsonencode.html
Here's a sample code snippet to help you get started with downloading the historical funding data using a MATLAB script:
httpsUrl = '<YOUR-API-URL>';
options = weboptions("RequestMethod", "post", 'ContentType', 'json', 'MediaType', 'application/json');
pair = '<CRYPTO-PAIR>';
requestBody = struct("symbol", pair, "page", 1, "rows", 10000);
jsonRequest = jsonencode(requestBody);
data = webwrite(httpsUrl, jsonRequest, options);
fundingTable = struct2table(data.data);
writetable(fundingTable, "Funding_Rates_" + pair + ".csv");
Feel free to adjust the script according to your specific requirements.
I hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Downloads についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!