# This is a simple stop-limit order that will sell at the limit price # if the FTSO oracle price drops below a stop price. # # The order has a internal switch to check that it only runs once. tokens: eusdt: address: 0x96B41289D90444B8adD57e6F265DB5aE8651DF29 decimals: 6 network: flare wflr: address: 0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d decimals: 18 network: flare orders: flare: orderbook: flare # vault-id is generated on cli `openssl rand -hex 32` inputs: - token: eusdt vault-id: 0xc000bc8ae30330757787fa5b6435b2bd5ecf8b0c087a8034a09cd0fda43513f0 outputs: - token: wflr vault-id: 0xc000bc8ae30330757787fa5b6435b2bd5ecf8b0c087a8034a09cd0fda43513f0 scenarios: flare: runs: 1 bindings: trade-amount: 5e18 limit-price: 35e15 stop-price: 5e16 deployments: flare: scenario: flare order: flare charts: Stop limit order selling WFLR: scenario: flare metrics: - label: FTSO price value: 0.0 - label: Stop price value: 0.1 - label: Limit price value: 0.2 - label: Trade amount (in $) value: 0.3 - label: Trade amount (in WFLR) value: 0.4 - label: IO ratio description: Amount of USD per WFLR sold. value: 0.5 --- #trade-amount !The amount of WFLR that we will sell. #stop-price !The price below which we'll sell WFLR. #limit-price !The price which we'll sell at if the FTSO reports a price below the stop price. #calculate-io using-words-from 0xAfD94467d2eC43D9aD39f835BA758b61b2f41A0E 0x50fB1Be59721E7A2a3434dDd726d53780bfDe344 ftso-price: ftso-current-price-usd("FLR" 3600), :ensure(less-than(ftso-price stop-price) "Threshold not hit."), /* ensure that this strat only runs once. */ :ensure(is-zero(get("did-run")) "Already run."), :set("did-run" 1), /* added this here to help charting */ _: stop-price, _: limit-price, input-amount: decimal18-mul(trade-amount limit-price), max-output: trade-amount, price: limit-price; #handle-io :;