# This strategy will buy WFLR based on the price of the FTSO pair FLR/USD # # The strategy has a cooldown specified in seconds, e.g. 300 = 5 minutes. # The strategy will not buy while the cooldown is active, so overall the # strategy functions like a dollar cost averaging process. tokens: eusdt: network: flare address: 0x96B41289D90444B8adD57e6F265DB5aE8651DF29 decimals: 6 wflr: network: flare address: 0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d decimals: 18 orders: # vault-id is `openssl rand -hex 32` buy-wflr: orderbook: flare inputs: - token: wflr vault-id: 0xc7d3ce731e01a8f2a9419f8747aa184eedbcb86fc44b29baf2dfbadce4dab4d7 outputs: - token: eusdt vault-id: 0xc7d3ce731e01a8f2a9419f8747aa184eedbcb86fc44b29baf2dfbadce4dab4d7 scenarios: default: deployer: flare runs: 1 bindings: cooldown-time: 30 per-trade-amount: 1e18 deployments: default: scenario: default order: buy-wflr charts: Per sale: scenario: default metrics: - label: FTSO price description: FLR per $ value: 0.1 - label: Cooldown time value: 0.3 - label: FLR per trade amount value: 0.2 - label: $ per trade amount value: 0.5 - label: IO ratio value: 0.6 --- #per-trade-amount !The amount that we'll buy or sell per trade. #cooldown-time !The minimum amount of seconds that must elapse between trades. #calculate-io using-words-from 0xAfD94467d2eC43D9aD39f835BA758b61b2f41A0E 0x50fB1Be59721E7A2a3434dDd726d53780bfDe344 now: block-timestamp(), /* ensure that the cooldown time has elapsed since the last trade */ :ensure( greater-than-or-equal-to( now int-add(get("last-traded-235") cooldown-time) ) "cooldown" ), :set("last-traded-235" now), /* getting a quote from the Flare FTSO */ ftso-price: decimal18-inv(ftso-current-price-usd("FLR" 3600)), adjusted-price: decimal18-mul(ftso-price 99e16), /* added for charting */ _: cooldown-time, flr-amount: decimal18-mul(ftso-price per-trade-amount), max-output: per-trade-amount, io-ratio: adjusted-price; #handle-io :;