# 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: buy-wflr: orderbook: flare inputs: - token: wflr outputs: - token: eusdt scenarios: default: deployer: flare runs: 1 bindings: cooldown-time: 30 per-trade-amount: 1 deployments: default: scenario: default order: buy-wflr charts: Per sale: scenario: default metrics: - label: FTSO price description: FLR per $ value: 0.2 - label: Cooldown time value: 0.4 - label: FLR per trade amount value: 0.5 - label: $ per trade amount value: 0.6 - label: IO ratio value: 0.7 --- #raindex-subparser 0x77991674ca8887D4ee1b583DB7324B41d5f894c4 #flare-subparser 0x57c613381deadaE520eC33556C1d51c9Dcb0adb3 #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 flare-subparser raindex-subparser now: block-timestamp(), /* ensure that the cooldown time has elapsed since the last trade */ cooldown-key: hash(order-hash() "last-traded"), :ensure( greater-than( now add(get(cooldown-key) cooldown-time)) "cooldown"), :set(cooldown-key now), /* getting a quote from the Flare FTSO */ ftso-price: inv(ftso-current-price-usd("FLR" 3600)), adjusted-price: mul(ftso-price 0.99), /* added for charting */ cd-time: cooldown-time, flr-amount: mul(ftso-price per-trade-amount), /***/ max-output: per-trade-amount, io-ratio: adjusted-price; #handle-io :;