Skip to content

Instantly share code, notes, and snippets.

@natyrix
Created October 15, 2022 22:23
Show Gist options
  • Save natyrix/ed5466e2d9f9bcaaa4006101e9d1c25b to your computer and use it in GitHub Desktop.
Save natyrix/ed5466e2d9f9bcaaa4006101e9d1c25b to your computer and use it in GitHub Desktop.
class VectorbotPipeline():
def __init__(self,user_id, indicator="sma",init_cash=1000, ema_value=0,stock='AMZN', fast_ma=10, slow_ma=50, start='2021-10-11', end='2022-10-11', period=None, fees=0.005, is_experiment=False):
self.user_id = user_id
self.init_cash = init_cash
self.ema_value = ema_value
self.indicator = indicator
self.stock = stock
self.fast_ma = fast_ma
self.slow_ma = slow_ma
self.start = start
self.end = end
self.period = period
self.fees = fees
self.is_experiment = is_experiment
self.price = vbt.YFData.download(self.stock, start=self.start, end=self.end).get('Close')
if(is_experiment):
try:
mlflow.end_run()
except:
pass
val = random.randint(1, 1000)
mlflow.set_experiment(f"{self.stock}_{self.init_cash}_{val}")
mlflow.set_tracking_uri('http://localhost:5000')
mlflow.start_run(run_name="self_stock")
mlflow.log_metric("experiment_extra_num", val)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment