Skip to content

Instantly share code, notes, and snippets.

🏎
Making high-frequency trading apps

Rick RickWong

🏎
Making high-frequency trading apps
Block or report user

Report or block RickWong

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View InMemoryCounter.js
class InMemoryCounter {
constructor({ seconds = 1, rolling = true, max }) {
this.seconds = seconds;
this.rolling = rolling;
this.max = max;
if (!this.rolling) {
this.interval = setInterval(() => {
this.counter = 0;
}, this.seconds * 1000);
View rikkert.express.js
const { listen, emit } = require("rikkert");
const express = require('express');
const app = express();
const rikkertMiddleware = (req, res, next) => {
emit("http.request", { req, res }).then(next);
};
app.use(rikkertMiddleware);
app.listen(3000);
@RickWong
RickWong / µredux.es6
Last active Aug 25, 2016 — forked from rstacruz/µredux.js
Redux in <1kb
View µredux.es6
const INIT = '@redux/INIT';
export const createStore = (reducer, state, enhancer) => {
if (enhancer) {
return enhancer(createStore)(reducer, state);
}
const subscribers = [];
dispatch({ type: INIT });
@RickWong
RickWong / blockchain.py
Created May 19, 2016 — forked from dela3499/blockchain.py
Implementation of simple blockchain
View blockchain.py
import numpy as np
import hashlib
def create_block(parent_block, value, hashfunc):
""" ------------------------------------------------
String -> Block -> (Block -> String) -> Block
------------------------------------------------
Produce a new block from a string value and a hash
of its parent block. In this case, a block is also a string.
"""
@RickWong
RickWong / react.html
Last active Feb 5, 2018
Write React apps in 1 HTML file.
View react.html
<html>
<body>
<div id="react-root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-with-addons.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.5.2/redux.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.7.7/babel.min.js"></script>
<script id="react-app" type="text/template">
const App = ({name}) => {
@RickWong
RickWong / app.js
Last active Nov 11, 2018
React without Webpack
View app.js
const App = ({name}) => {
return (
<h1>Hello {name}</h1>
);
};
ReactDOM.render(<App name="World" />, document.getElementById("App"));
@RickWong
RickWong / decorate.js
Created Aug 8, 2015
ES6 function decorators
View decorate.js
function decorate (...functions) {
return functions.reduce(
(a, b) => b(a),
functions.pop() // Pop wrapped function as initial value
);
};
decorate(
(func) => (text) => func(text.toUpperCase() + "!"), // Outer-wrapper
You can’t perform that action at this time.