Skip to content

Instantly share code, notes, and snippets.

@natyrix
Last active October 16, 2022 04:01
Show Gist options
  • Save natyrix/1e39fe041e9ed51dc8e338281ac96fb3 to your computer and use it in GitHub Desktop.
Save natyrix/1e39fe041e9ed51dc8e338281ac96fb3 to your computer and use it in GitHub Desktop.
async function runTest(e){
e.preventDefault()
try{
setIsLoading(true)
let response = await axios.post(`${BASE_URL}/get_backtest_scene`, {
"start_date":startDate,
"end_date":endDate,
"indicator":selectedindicator,
"initial_cash":initCash,
"stock":selectedCoin,
"user_id":User.id,
})
console.log(response.data)
let data = response.data;
if(data!==undefined){
if(data.success){
alert(data.message)
}else{
alert(data.error)
}
}
else{
alert("Something went wrong")
}
}catch(e){
console.log(e)
alert(e.message)
}finally{
setIsLoading(false)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment