-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathcreate_workflow.py
More file actions
32 lines (25 loc) · 901 Bytes
/
create_workflow.py
File metadata and controls
32 lines (25 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import opengradient as og
alpha = og.Alpha(private_key=os.environ.get("OG_PRIVATE_KEY"))
# Define model input
input_query = og.HistoricalInputQuery(
base="ETH",
quote="USD",
total_candles=10,
candle_duration_in_mins=30,
order=og.CandleOrder.ASCENDING,
candle_types=[og.CandleType.OPEN, og.CandleType.HIGH, og.CandleType.LOW, og.CandleType.CLOSE],
)
# Define schedule
scheduler_params = og.SchedulerParams(frequency=60, duration_hours=2)
# Base model CID (ETH volatility forecast) - from https://hub.opengradient.ai
model_cid = "hJD2Ja3akZFt1A2LT-D_1oxOCz_OtuGYw4V9eE1m39M"
# Deploy schedule
contract_address = alpha.new_workflow(
model_cid=model_cid,
input_query=input_query,
# Input name in ONNX model
input_tensor_name="open_high_low_close",
scheduler_params=scheduler_params,
)
print(f"Deployed workflow at address: {contract_address}")