Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time interval GetCandlesAsynch not working correct #502

Open
Speed1972 opened this issue Dec 3, 2019 · 8 comments
Open

Time interval GetCandlesAsynch not working correct #502

Speed1972 opened this issue Dec 3, 2019 · 8 comments

Comments

@Speed1972
Copy link

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);

@vslee
Copy link
Collaborator

vslee commented Dec 3, 2019

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.

@Speed1972
Copy link
Author

Can you explane yourself a bit more?

@vslee
Copy link
Collaborator

vslee commented Dec 5, 2019

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.

@Speed1972
Copy link
Author

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

@vslee
Copy link
Collaborator

vslee commented Dec 6, 2019

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.

@vslee
Copy link
Collaborator

vslee commented Dec 15, 2019

@Speed1972, #504 is an example of how to send us the fix if you don't know how to send a pull request.

@PeetCrypto
Copy link

PeetCrypto commented Jan 8, 2020

@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:
image

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?

@vslee
Copy link
Collaborator

vslee commented Jan 20, 2020

@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

  • 1m
  • 3m
  • 5m
  • 15m
  • 30m
  • 1h
  • 2h
  • 4h
  • 6h
  • 8h
  • 12h
  • 1d
  • 3d
  • 1w
  • 1M

If you can update the code you pasted above with these new values, then I will handle the rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants