-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alan
committed
Apr 12, 2024
1 parent
4b89ef6
commit ee7b5b7
Showing
6 changed files
with
2,623 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,39 @@ | ||
import joblib | ||
from schema import ModelDayInput | ||
import pandas as pd | ||
|
||
|
||
class Model: | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
def __init__(self): | ||
self.moex_preprocess = joblib.load("./model_ser/moex_pipeline.plk") | ||
|
||
def forward(self, data: ModelDayInput): | ||
moex_df = pd.DataFrame( | ||
{ | ||
"CAPITALIZATION": [data.CAPITALIZATION] * 2, | ||
"CLOSE": [data.CAPITALIZATION] * 2, | ||
"DIVISOR": [data.CAPITALIZATION] * 2, | ||
"HIGH": [data.CAPITALIZATION] * 2, | ||
"LOW": [data.CAPITALIZATION] * 2, | ||
"OPEN": [data.CAPITALIZATION] * 2, | ||
"TRADEDATE": [str(data.TRADEDATE)] * 2, | ||
"NAME": [None] * 2, | ||
"SHORTNAME": [None] * 2, | ||
"SECID": [None] * 2, | ||
"BOARDID": [None] * 2, | ||
"DURATION": [None] * 2, | ||
"YIELD": [None] * 2, | ||
"DECIMALS": [None] * 2, | ||
"CURRENCYID": [None] * 2, | ||
"VOLUME": [None] * 2, | ||
"TRADINGSESSION": [None] * 2, | ||
"VALUE": [None] * 2, | ||
} | ||
) | ||
|
||
moex_df = self.moex_preprocess.transform(moex_df) | ||
|
||
def forward(self, *args, **kwargs): | ||
return [42.0, 1, 2, 3] | ||
return moex_df.to_dict() | ||
|
||
def __call__(self, *args, **kwargs): | ||
return self.forward(*args, **kwargs) | ||
def __call__(self, data: ModelDayInput): | ||
return self.forward(data) |
Oops, something went wrong.