This repository has been archived by the owner on Sep 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
streaming-gui-example.rain
174 lines (154 loc) · 4.11 KB
/
streaming-gui-example.rain
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# This strategy will buy WFLR based on the price of the FTSO pair FLR/USD
#
# This strategy is a streaming strategy, meaning it has a fixed budget over time,
# vs a cooldown with set amounts per trade.
networks:
flare-dca:
rpc: https://rpc.ankr.com/flare
chain-id: 14
network-id: 14
currency: FLR
subgraphs:
flare-dca: https://api.goldsky.com/api/public/project_clv14x04y9kzi01saerx7bxpg/subgraphs/ob-flare-0xb06202aA/1.0.0/gn
metaboards:
flare-dca: http://subgraphs.h20liquidity.tech/subgraphs/name/flare-mb-0x59401C93
orderbooks:
flare-dca:
address: 0xb06202aA3Fe7d85171fB7aA5f17011d17E63f382
deployers:
flare-dca:
address: 0xd58583e0C5C00C6DCF0137809EA58E9d55A72d66
network: flare-dca
tokens:
eusdt:
network: flare-dca
address: 0x96B41289D90444B8adD57e6F265DB5aE8651DF29
decimals: 6
weth:
network: flare-dca
address: 0x96B41289D90444B8adD57e6F265DB5aE8651DF29
decimals: 6
wflr:
network: flare-dca
address: 0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d
decimals: 18
orders:
buy-wflr-w-usd:
orderbook: flare-dca
inputs:
- token: wflr
vault-id: 0xee4c4284a414696a5d768fb71329ffbb961a7184079aa0f25390deb29193b4f1
outputs:
- token: usdt
vault-id: 0xee4c4284a414696a5d768fb71329ffbb961a7184079aa0f25390deb29193b4f1
- token: usdc
vault-id: 0xee4c4284a414696a5d768fb71329ffbb961a7184079aa0f25390deb29193b4f1
buy-wflr-w-weth:
orderbook: flare-dca
inputs:
- token: wflr
vault-id: 0xee4c4284a414696a5d768fb71329ffbb961a7184079aa0f25390deb29193b4f1
outputs:
- token: weth
vault-id: 0xee4c4284a414696a5d768fb71329ffbb961a7184079aa0f25390deb29193b4f1
scenarios:
default:
deployer: flare-dca
runs: 1
bindings:
start-time: 123456
other:
deployer: flare-dca
runs: 1
bindings:
deployments:
usd:
scenario: default
order: buy-wflr-w-usd
weth:
scenario: other
order: buy-wflr-w-weth
gui:
name: DCA into WFLR
description: Buy FLARE!
deployments:
- deployment: usd
name: DCA into WFLR with USD
fields:
- binding: amount
name: Amount
description: The amount of USD you want to spend each day.
min: 10
presets:
- 1
- 5
- 10
- binding: frequency
name: Frequency
description: Number of days between DCA purchases.
min: 10
presets:
- 1
- 7
- 14
- 28
deposit:
min: 20
presets:
- 10
- 50
- 100
- deployment: weth
name: DCA into WFLR with WETH
fields:
- binding: amount
name: Amount
description: The amount of WETH you want to spend each day.
presets:
- 0.001
- 0.002
- 0.005
deposit:
min: 0.01
presets:
- 0.01
- 0.02
- 0.05
charts:
DCA Strategy:
scenario: default
metrics:
- label: Time elapsed
description: (in seconds)
value: 0.3
- label: Budget to date
unit-prefix: $
value: 0.4
- label: FLR-USD
unit-prefix: $
value: 0.7
- label: USD-FLR
value: 0.8
unit-suffix: " FLR"
- label: Final USD-FLR
value: 0.10
unit-suffix: " FLR"
---
#amount !the amount
#calculate-io
using-words-from 0x31A76D8644612e0ABD1aF0D42909Ed57F16F608D 0xCE6ad0ba209e7D3B59Ddb8a63595193C11C3B0aB
start-time: 1720361228,
budget-per-day: 10,
budget-per-second: div(budget-per-day 86400),
time-elapsed: sub(now() start-time),
budget-to-date: mul(time-elapsed budget-per-second),
spent-so-far: get(order-hash()),
spend-this-time: sub(budget-to-date spent-so-far),
/* getting a quote from the Flare oracle, the FTSO */
flr-usd: ftso-current-price-usd("FLR" 3600),
usd-flr: inv(flr-usd),
max-output: spend-this-time,
io-ratio: mul(0.9 usd-flr),
:set(order-hash() add(spent-so-far spend-this-time));
#handle-io
:;