https://realpython.com/blog/python/asynchronous-tasks-with-django-and-celery/
$ pip install celery
$ sudo apt-get install rabbitmq-server
def calc_relative_diff(history_price, latest_price): | |
price_diff = latest_price - history_price | |
return round(price_diff / history_price, 2) | |
def calc_volume_diff(history_volume, latest_volume): | |
return latest_volume - history_volume | |
def calc_market_cap_diff(market_cap, history_price, latest_price): |
from datetime import datetime | |
from random import randint | |
class MovAvgCalculator: | |
def __init__(self, starting_list=None, window_duration=3600): | |
self.moving_average = None | |
if starting_list: | |
self.my_list = starting_list | |
self.sum = sum(starting_list) |
/** | |
* npm install -g crypto-js | |
* npm install -g request | |
*/ | |
var crypto = require('crypto-js'); | |
var public_key = 'enter your public key'; | |
var secret_key = 'enter your secret key'; | |
var timestamp = Math.floor(Date.now() / 1000); |
import hashlib | |
import hmac | |
import requests | |
import time | |
secret_key = 'enter your secret key' | |
public_key = 'enter your public key' | |
timestamp = int(time.time()) | |
payload = '{}.{}'.format(timestamp, public_key) | |
hex_hash = hmac.new(secret_key.encode(), msg=payload.encode(), digestmod=hashlib.sha256).hexdigest() |
# Install with > pip install bitcoinaverage | |
from bitcoinaverage import TickerWebsocketClientV2 | |
class MyWebsocketClient(TickerWebsocketClientV2): | |
def received_message(self, message): | |
print("Received price update") | |
print(message) |
// Install with: > npm install bitcoinaverage | |
const ba = require('bitcoinaverage'); | |
var pub = '<your public key>'; | |
var secret = '<your secret key>'; | |
var wsClient = ba.websocketClient(pub, secret); | |
wsClient.connectToTickerWebsocketV2('global', ['ETHUSD', 'BCHUSD', 'LTCUSD', 'ETCUSD'], function(response) { | |
console.log(response.data.global); |
https://realpython.com/blog/python/asynchronous-tasks-with-django-and-celery/
$ pip install celery
$ sudo apt-get install rabbitmq-server
This document is a collection of concepts and strategies to make large Elm projects modular and extensible.
We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp
. You will probably merge
a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state: