Skip to content

Instantly share code, notes, and snippets.

@leovarmak
Last active October 26, 2017 05:41
Show Gist options
  • Save leovarmak/ae6b3f36d2ec4fd490115f16a6c7f6af to your computer and use it in GitHub Desktop.
Save leovarmak/ae6b3f36d2ec4fd490115f16a6c7f6af to your computer and use it in GitHub Desktop.
Koinex
<!DOCTYPE html>
<html>
<head>
<title>Koinex</title>
<script src="https://unpkg.com/moonjs/dist/moon.js"></script>
</head>
<body>
<h4>
<div id="app1">
Buying
₹<input m-model="user_amount" placeholder="user_amount">
worth
<input m-model="crypto" placeholder="BTC" disabled>
at
<input m-model="fixed_rate" placeholder="343000">
per
<input m-model="fixed_rate_crypto_type" placeholder="BTC" disabled>
generates ------------>
<input m-model="volume" placeholder="volume" disabled> Volume
|| Fee
<input m-model="total_fee" placeholder="total_fee" disabled>
</h4>
</body>
<script>
const app1 = new Moon({
el: "#app1",
data: {
user_amount: 680000,
crypto: "BTC",
fixed_rate: 343000,
fixed_rate_crypto_type: "BTC",
fee: 0.0025,
total_fee: 0
},
computed: {
volume: {
get: function() {
var user_amount = this.get("user_amount");
return (user_amount - (user_amount * this.get("fee"))) / (this.get("fixed_rate"))
}
},
total_fee: {
get: function() {
var user_amount = this.get("user_amount");
return (user_amount * this.get("fee"))
}
}
}
});
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment