Skip to content

Commit

Permalink
refine quote parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ghill2 committed Oct 23, 2024
1 parent c76ff36 commit 195b8d3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions nautilus_core/persistence/src/arrow/quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,22 @@ impl DecodeFromRecordBatch for QuoteTick {
let ts_init = ts_init_values.value(i).into();

let mut instrument_id_ = instrument_id;
if !instrument_id.symbol.as_str().ends_with("IDEALPRO=CASH") {

let symbol = instrument_id.symbol.as_str();
let is_currency_pair = symbol.ends_with("CASH") || symbol.ends_with("IND");
if !is_currency_pair {

let mut index: usize = ts_event
.as_u64()
.to_string()
[4..6]
.parse()
.expect("Not a valid number");

index -= 1;
if index >= letter_months.len() {
panic!("index < letter_months: index is {:?} {:?}", index, instrument_id)
}
assert!(index < letter_months.len());

let letter = letter_months[index];
let year = &ts_event.as_u64().to_string()[0..4];
Expand Down

0 comments on commit 195b8d3

Please sign in to comment.