add many change
This commit is contained in:
7
state.py
7
state.py
@@ -4,8 +4,6 @@ CONVERSION_FEE = 5
|
||||
class StateManager:
|
||||
def __init__(self):
|
||||
symbols = ["BOND", "VALBZ", "VALE", "GS", "MS", "WFC", "XLF"]
|
||||
self.positions = {s: 0 for s in symbols}
|
||||
self.orders = {s: {} for s in symbols}
|
||||
self.bid_prices = {s: None for s in symbols}
|
||||
self.ask_prices = {s: None for s in symbols}
|
||||
self.bid_depths = {s: 0 for s in symbols}
|
||||
@@ -26,6 +24,9 @@ class StateManager:
|
||||
}
|
||||
self.etf_shares = {"XLF": 10}
|
||||
|
||||
def set_last_price(self, symbol: str, price: int):
|
||||
self.last_prices[symbol] = price
|
||||
|
||||
def get_last_price(self, symbol: str):
|
||||
return self.last_prices.get(symbol)
|
||||
|
||||
@@ -71,7 +72,7 @@ class StateManager:
|
||||
self.predicted_prices[symbol] = mid
|
||||
|
||||
def update_fair_value(self):
|
||||
valbz_price = self.get_predicted_price("VALBZ")
|
||||
valbz_price = self.last_prices.get("VALBZ")
|
||||
if valbz_price is not None:
|
||||
self.fair_values["VALBZ"] = valbz_price
|
||||
self.fair_values["VALE"] = valbz_price
|
||||
|
||||
Reference in New Issue
Block a user