Skip to content

Commit

Permalink
Merge pull request #162 from ultima-ib/pyrelease
Browse files Browse the repository at this point in the history
Pyrelease
  • Loading branch information
AnatolyBuga authored Jul 22, 2023
2 parents eec934c + af2f3b5 commit 2c01b9a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
10 changes: 7 additions & 3 deletions frtb_engine/data/frtb/datasource_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ type = "CSV"
#If using AwsCSV then provide the bucket name
#bucket = "ultima-bi"

# source_type defaults to "InMemory"
# can be one of "InMemory", "Scan", "Db" (work in progress).
#source_type = "InMemory"

# Risk file paths, can be many, expecting at least one
files = ["data/frtb/Delta.csv"]
files = ["./data/frtb/Delta.csv"]

# Optional: trade attributes
attributes_path = "data/frtb/TradeAttributes.csv"
attributes_path = "./data/frtb/TradeAttributes.csv"

# Optional: Hierarchy
hierarchy_path = "data/frtb/hms.csv"
hierarchy_path = "./data/frtb/hms.csv"

# file_1/file_2/file_3 <-> attributes
# must be provided if attributes file is provided
Expand Down
1 change: 0 additions & 1 deletion frtb_engine/src/sbm/fx/delta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ fn fx_delta_charge(gamma: f64, rtrn: ReturnMetric, ccy_regex: String) -> PolarsR
//21.4.5.a sb == dw_sum
let dw_sum = df["dw_sum"].f64()?.to_ndarray()?; //Ok since we have filtered out NULLs above
// Early return Kb or Sb, ie the required metric
dbg!(&dw_sum);
let res_len = columns[0].len();
if let ReturnMetric::Sb = rtrn {
return Ok(Some(Series::new("res", [dw_sum.sum()])));
Expand Down
4 changes: 2 additions & 2 deletions pyultima/src/conversions/series.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![allow(dead_code)]

use std::collections::HashMap;
use polars::export::arrow;
use arrow::ffi;
use polars::export::arrow;
use polars::prelude::*;
use std::collections::HashMap;
//use polars_arrow::export::arrow;
use pyo3::exceptions::PyValueError;
use pyo3::ffi::Py_uintptr_t;
Expand Down
5 changes: 2 additions & 3 deletions pyultima/ultibi/internals/datasource.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from polars import DataFrame, LazyFrame
from typing_extensions import Self

from ..rust_module.ultibi_engine import DataSourceWrapper

Expand Down Expand Up @@ -55,11 +54,11 @@ class DataSource:
inner: DataSourceWrapper

@classmethod
def inmemory(cls, data: DataFrame) -> Self:
def inmemory(cls, data: DataFrame) -> "DataSource":
return cls(data)

@classmethod
def scan(cls, data: LazyFrame) -> Self:
def scan(cls, data: LazyFrame) -> "DataSource":
return cls(data)

def __init__(self, data: "DataFrame | LazyFrame | str"):
Expand Down

0 comments on commit 2c01b9a

Please sign in to comment.