-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Moneypot simulation #15
base: master
Are you sure you want to change the base?
Changes from 3 commits
d367572
3d5f91b
a79ba33
38bc2c4
94ea5da
8fde2e3
ab5b549
96948ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
let Simulation = require('./simulation') | ||
let modules = require('./strategies') | ||
let feeRate = 56 * 100 | ||
let results = [] | ||
|
||
let list = require('./moneypot-hotwallet.json') | ||
|
||
// for each strategy | ||
for (var name in modules) { | ||
let f = modules[name] | ||
let simulation = new Simulation(name, f, feeRate) | ||
|
||
console.log(name) | ||
let i = 0 | ||
for (var value of list) { | ||
i++ | ||
|
||
if (i % 1000 === 0) { | ||
console.log(i) | ||
} | ||
let txo = { | ||
address: 'A', | ||
value: Math.abs(value) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
solved There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (OK, I thought coin selection simulation will be a quick task, and it takes me quite a while. :D Luckily, I have two different implementations, one here and one in scala, and I am looking at where they differ :D ) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No worries. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer development in PRs too |
||
} | ||
|
||
if (value > 0) { | ||
simulation.addUTXO(txo) | ||
} else { | ||
simulation.run([txo]) | ||
} | ||
} | ||
|
||
simulation.finish() | ||
results.push(simulation) | ||
} | ||
|
||
Simulation.printResults(Simulation.mergeResults(results)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rename this to
data
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to name it like this so more data can be added eventually