This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Import everything | |
import { Wallet, BigNumber, ethers, providers } from 'ethers' | |
const { FlashbotsBundleProvider, FlashbotsBundleResolution } = require('@flashbots/ethers-provider-bundle') | |
/* | |
Mainnet | |
const provider = new providers.JsonRpcProvider('https://eth-mainnet.g.alchemy.com/v2/cmHEQqWnoliAP0lgTieeUtwHi0KxEOlh') | |
const wsProvider = new providers.WebSocketProvider('wss://eth-mainnet.g.alchemy.com/v2/cmHEQqWnoliAP0lgTieeUtwHi0KxEOlh') | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
combineLatest, | |
distinctUntilChanged, | |
filter, | |
map, | |
Observable, | |
scan, | |
shareReplay, | |
switchMap, | |
withLatestFrom |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from typing import Iterable, Union, Any | |
# freq: frequency in Hz | |
# zerolen: length of space bit in μs | |
# onelen: length of mark bit in μs | |
# repeats: number of times to repeat sequence | |
# pause: time to wait in μs between sequences | |
# bits: string of ones and zeros to represent sequence |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!make | |
KAFKA_BOOTSTRAP_SERVER=localhost:9092 | |
KAFKA_TOPICS_FILE=./config/kafka/topics.txt | |
kafka-topics-create: | |
awk -F':' '{ system("kafka-topics.sh --create --bootstrap-server ${KAFKA_BOOTSTRAP_SERVER} --topic="$$1" --partitions="$$2" --replication-factor="$$3" --config="$$4) }' \ | |
${KAFKA_TOPICS_FILE} | |
.PHONY: kafka-topics-create |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const signSecret = process.env.SLACK_SIGN_SECRET; | |
const validateRequest = (requestSignature, requestTime, rawBody, validFor = 300) => { | |
const requestValidFrom = Math.floor(Date.now() / 1000) - validFor; | |
if (requestTime < requestValidFrom) { | |
throw new Error(`Request outdated: !(${requestTime} < ${requestValidFrom})`); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { streamNormalized, normalizeLiquidations, combine, Liquidation } from 'tardis-dev' | |
// let's monitor BTC perpetuals swaps only | |
const monitoredExchanges = [ | |
{ id: 'ftx', symbols: ['BTC-PERP'] }, | |
{ id: 'bitmex', symbols: ['XBTUSD'] }, | |
{ id: 'deribit', symbols: ['BTC-PERPETUAL'] }, | |
{ id: 'binance-futures', symbols: ['BTCUSDT'] }, | |
{ id: 'binance-delivery', symbols: ['BTCUSD_PERP'] }, | |
{ id: 'bitfinex-derivatives', symbols: ['BTCF0:USTF0'] }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function partition(inputArray, callback) { | |
const result = {}; | |
for (const [indexOfValue, value] of inputArray.entries()) { | |
const propertyKey = callback(value, indexOfValue); | |
if (propertyKey === null || propertyKey === '') { | |
continue; | |
} | |
if (!{}.hasOwnProperty.call(result, propertyKey)) { | |
result[propertyKey] = []; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const submitEvent = { | |
SUBMIT: [ | |
{ | |
target: 'submitting', | |
cond: 'isValidData', | |
}, | |
{ target: 'error' }, | |
], | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const designerSubChart = { | |
initial: 'standard', | |
states: { | |
standard: { | |
on: { | |
'': { | |
target: 'readOnly', | |
cond: 'hasReadOnlyParam' | |
}, | |
ENTER_PREVIEW: 'preview', |
NewerOlder