Skip to content

Instantly share code, notes, and snippets.

View abel30567's full-sized avatar
🐉
Creating

Claudio Atilano abel30567

🐉
Creating
View GitHub Profile
const bitcore = require('bitcore-lib');
const Insight = require('bitcore-insight').Insight;
let insight = new Insight('testnet');
// Our private key and address
const wif = 'xBtatQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct';
const privateKey = new bitcore.PrivateKey(wif);
const myAddress = privateKey.toAddress();
@abel30567
abel30567 / marketCapWeighted.js
Last active January 4, 2019 21:12
Top 20 Cryptocurrency Market Cap Weighted Algorithm
const request = require('request');
const Table = require('cli-table');
// Algorithm will run every 5 seconds
setInterval( () =>{
// API request to Coin Market Cap for top 20 cryptocurrencies
request('https://api.coinmarketcap.com/v1/ticker/', function(error, response, body) {
const chart = JSON.parse(body);
// The cap of how much of the portfolio could allocate to a certain cryptocurrency (0.05 = 5%)
// no cryptocurrency will surpass this cap amount in portfolio allocation.
@abel30567
abel30567 / hodl20.py
Created May 14, 2018 22:15 — forked from anthonytxie/hodl20.py
Hodl 20 Rebalancing Algorithm
def calc_allocations(self, date, quantity, cap):
"""Figure out ideal allocations for a given date"""
# {
# coin_name: (percent_allocation, data)
# }
top_market = self.get_top_market(date, quantity)
total_cap = sum([coin.market_cap for coin in top_market])
allocations = [{