Skip to content

Commit

Permalink
feat(strategy): allow for manual allocation recommendation (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
gosuto-inzasheru authored and benmarten committed Jan 22, 2018
1 parent d5ab3e7 commit f47a63f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ The tool expects your settings in settings.json. Take a look at settings.example
- *accounts*: Under accounts, fill in your api credentials for the exchange that you want to use. Delete the exchanges that you do not need.
- *symbolMapping*: Some exchanges use different symbols that coinmarketcap.com. Hence here you can map the symbols, e.g.: map MIOTA to IOTA.
- *otherHoldings*: A place to manually add some of your holdings. Notation is key: Symbol, value is amount of native currency.
- *allocations*: Here you can manually define allocations of coins. The allocations is calculated from the amount of points it gets relative to the total amount of points. Filling in `66.67` and `33.33` for two currencies will yield the same result as `6` and `3` for example. If allocations is not mentioned in settings.json the allocations will reflect the coin's market cap relative to the other coins in the portfolio.
- *options*: These are specific options for the tool:
- targetValueUsd: The target value for your ETF; A general rule of thumb is to keep your crypto at a certain percentage of your overall investment portfolio. This could be 5, 10, 20 or more percent, depending on your risk tolerance.
- Default [false]: Use current portfolio value as target value.
Expand Down
11 changes: 9 additions & 2 deletions settings.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,26 @@
}]
},
"symbolNameMapping": {
"Bitgem": "BITG"
"Remicoin": "REMI",
"KingN Coin": "KINGN",
"ENTCash": "ENTCASH"
},
"symbolMapping": {
"USD": "USDT",
"STR": "XLM",
"IOTA": "MIOTA",
"XBT": "BTC"
"XBT": "BTC",
"XDG": "DOGE"
},
"otherHoldings": [{
"BCH": 1.0
}, {
"BTG": 1.0
}],
"allocations": {
"BTC": 66,
"ETH": 33
},
"options": {
"targetValueUsd": false,
"rebalanceDeltaPct": 1.0,
Expand Down
12 changes: 10 additions & 2 deletions src/model/Coin.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ export default class Coin {
}

getRelativeMarketCapRecommended() {
return Coinmarket.getRelativeMarketCapForX(this.symbol)
if (Settings.hasOwnProperty('allocations')) {
if (Settings.allocations.hasOwnProperty(this.symbol)) {
return Settings.allocations[this.symbol]
} else {
return 0
}
} else {
return Coinmarket.getRelativeMarketCapForX(this.symbol)
}
}

getAllocationDeltaPct() {
Expand Down Expand Up @@ -114,4 +122,4 @@ export default class Coin {

return (result.charAt(result.length - 1) === ',') ? result.slice(0, -1) : result
}
}
}

0 comments on commit f47a63f

Please sign in to comment.