Skip to content

Instantly share code, notes, and snippets.

@tansawit
Last active July 10, 2020 04:52
Show Gist options
  • Save tansawit/08e98c9fd437a43a9011712747edfd07 to your computer and use it in GitHub Desktop.
Save tansawit/08e98c9fd437a43a9011712747edfd07 to your computer and use it in GitHub Desktop.
// Preparation Phase
#[no_mangle]
fn prepare_impl(input: Input) {
// Coingecko volume data source
oei::ask_external_data(1, 9, &input.symbol.as_bytes());
}
// Execution Phase
#[no_mangle]
fn execute_impl(input: Input) -> Output {
let avg: f64 = ext::load_average(1);
Output { volume: (avg * input.multiplier as f64) as u64 }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment