fix(data): add missing 3d and 1M Binance kline intervals (#312)
Binance supports 16 kline intervals (1s,1m,3m,5m,15m,30m,1h,2h,4h,6h,8h, 12h,1d,3d,1w,1M); the live-binance `Interval` enum listed only 14, missing three-day (`3d`) and one-month (`1M`). Add both variants in Binance order with their wire-format strings, and extend the exhaustive as_str test.
This commit is contained in:
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- **Binance kline feed: add the missing `3d` and `1M` intervals.** The
|
||||||
|
`live-binance` `Interval` enum was missing three-day (`3d`) and one-month (`1M`)
|
||||||
|
candles, two of Binance's 16 supported kline intervals. Both are now selectable
|
||||||
|
and map to the correct wire-format strings.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- **CSV candle reading in all 10 languages (data layer).** The `CandleReader`
|
- **CSV candle reading in all 10 languages (data layer).** The `CandleReader`
|
||||||
parses a `timestamp,open,high,low,close,volume` CSV buffer (a leading UTF-8 BOM
|
parses a `timestamp,open,high,low,close,volume` CSV buffer (a leading UTF-8 BOM
|
||||||
|
|||||||
@@ -92,7 +92,9 @@ pub enum Interval {
|
|||||||
EightHours,
|
EightHours,
|
||||||
TwelveHours,
|
TwelveHours,
|
||||||
OneDay,
|
OneDay,
|
||||||
|
ThreeDays,
|
||||||
OneWeek,
|
OneWeek,
|
||||||
|
OneMonth,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Interval {
|
impl Interval {
|
||||||
@@ -112,7 +114,9 @@ impl Interval {
|
|||||||
Self::EightHours => "8h",
|
Self::EightHours => "8h",
|
||||||
Self::TwelveHours => "12h",
|
Self::TwelveHours => "12h",
|
||||||
Self::OneDay => "1d",
|
Self::OneDay => "1d",
|
||||||
|
Self::ThreeDays => "3d",
|
||||||
Self::OneWeek => "1w",
|
Self::OneWeek => "1w",
|
||||||
|
Self::OneMonth => "1M",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -413,7 +417,9 @@ mod tests {
|
|||||||
(Interval::EightHours, "8h"),
|
(Interval::EightHours, "8h"),
|
||||||
(Interval::TwelveHours, "12h"),
|
(Interval::TwelveHours, "12h"),
|
||||||
(Interval::OneDay, "1d"),
|
(Interval::OneDay, "1d"),
|
||||||
|
(Interval::ThreeDays, "3d"),
|
||||||
(Interval::OneWeek, "1w"),
|
(Interval::OneWeek, "1w"),
|
||||||
|
(Interval::OneMonth, "1M"),
|
||||||
];
|
];
|
||||||
for (iv, expected) in pairs {
|
for (iv, expected) in pairs {
|
||||||
assert_eq!(iv.as_str(), *expected);
|
assert_eq!(iv.as_str(), *expected);
|
||||||
|
|||||||
Reference in New Issue
Block a user