Open Speed1972 opened 5 years ago
Not the prettiest fix, but you could send us a PR which uses a switch
on periodSeconds
. If it is a valid value, then it would send the appropriate corresponding string (w/ intervalLetter M) to Binance.
Can you explane yourself a bit more?
If Binance is the exchange you use, then send us an updated version of OnGetCandlesAsync()
and possibly CryptoUtility.SecondsToPeriodString()
. If you do change CryptoUtility.SecondsToPeriodString()
, please make sure you don't break any other exchanges in the process of fixing Binance.
I was supposed to help you with potential problems in the open source code that you wrote. But you want me to solve those problems too? Do you also want me to look at another code from you to solve the problems there too? Or rewrite part of the code?
PS. Not only Binance uses Interval Letters
We welcome code contributions / pull requests. Like you, we do this in our free time. We then share our results with the community for free. If you're not interested, then we can close this issue. There's no need for you to have attitude or get upset.
@Speed1972, #504 is an example of how to send us the fix if you don't know how to send a pull request.
@vslee how would you like this isseu to be soulved if i do not know how to code but inderstand what must be changed? Binance uses Intervaltellers:
Just like the change #504 the secondes must be changed to interval letters. Just like in the code of HitBTC the code must look like: public override string PeriodSecondsToString(int seconds) { switch (seconds) { case 60: return "M1"; case 180: return "M3"; case 300: return "M5"; case 900: return "M15"; case 1800: return "M30"; case 3600: return "H1"; case 14400: return "H4"; case 86400: return "D1"; case 604800: return "D7"; case 4233600: return "1M"; default: throw new ArgumentException($"{nameof(seconds)} must be 60, 180, 300, 900, 1800, 3600, 14400, 86400, 604800, 4233600"); } }
Exact the same way like in the HitBTC code (ExchangeHitbtcAPI.cs) the code must be inster into the binance code. How to do that? Maybe it is a cut/past for you?
@CryptoP2345 The pasted code only works for HitBTC. In Binance, the allowed parameters are (scroll down to the ENUM definitions):
Kline/Candlestick chart intervals:
m -> minutes; h -> hours; d -> days; w -> weeks; M -> months
If you can update the code you pasted above with these new values, then I will handle the rest.
Api interval now a days has interval letter added to the time interval string. Example Binance: intervalNum describes the amount of the interval. For example, intervalNum 5 with intervalLetter M means "Every 5 minutes".
The Defined GetCandleAsync (in ExchnageAPI) has only the period Seconds without the intervalletter.
GetCandlesAsync(string marketSymbol, int periodSeconds, DateTime? startDate = null, DateTime? endDate = null, int? limit = null);