Get funding fee history information from Binance
This is a pretty simple python script designed to pull funding fee histories from Binance to aid in the creation of Spot-Arbitrage Bots on Pionex.
The information is available via the web at Binance. However, it is difficult to compare tokens side by side. Instead, this script pulls the history going back a determined amount and displays the average funding fee, the stdev (to give a sense of its variation), the low and high so you can see if it's gone negative, as well as the number of historical data points used.
If you don't want to run the script yourself, I try to keep a reasonably up-to-date spreadsheet on Google Sheets.
- Python 3
- Pandas in additional to other standard libraries. Easily installed using pip if needed.
./funding_history.py
-d {optional} Days of history to fetch. Defaults to 7 days.
-s {optional} Weighting factor (span) for Exponentially Weighted Moving Average (EWMA). How much recent funding fees will outweigh old ones. Defaults to 9 funding periods.
-v {optional} Verbose. Will print out the symbols as it processes.
- Add some measure of the variability of the token itself. This can be helpful to avoid tokens that come with higher risk of deleverage events, but I'm working on which stat to use still.
xuefeng-huang for adding the calculations to the script, rather than depending on Google Sheets.