This file contains 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 digits(n) { | |
return Math.floor(Math.log(n) / Math.log(10)); | |
} | |
function round10(value, exp) { | |
return decimalAdjust('round', value, exp); | |
} | |
function decimalAdjust(type, value, exp) { |
This file contains 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
module.exports = { | |
// given an array of timestamps only, returns a set of relevant timestamps | |
// to previous hours, only allowing one timestamp per hour | |
hourlyTimestamps: function (array){ | |
const now = new Date().getTime(); | |
let msh = 3.6e+6; // milliseconds per hour | |
let hoursGone = 0; | |
let theseHours = []; // array of representative data on an hourly basis, 0 if no data | |
let analysisDuration = 168; // hours in a given week. |
This file contains 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
// Note: internal implementation. This does not use the snowsignals-api npm package, examples coming soon | |
// see also http://snowsignals.com:3333/apiDocs | |
const signalsApi = require('../api.js'); | |
module.exports = { | |
whatThink: function(job){ | |
return new Promise(async (resolve, reject) => { | |
job.emaslowemaw = 40; |
This file contains 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 chalk = require('chalk'); | |
const player = require('play-sound')(); | |
const eventManager = require('../operations/eventManager'); | |
const diagnostics = require('../utilities/diagnostics.js'); | |
const request = require('request'); | |
let executeTrades = true; | |
let lastBalanceTime = 0; | |
let lastBalance; |
This file contains 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
/* | |
* deliverableWithFee.js | |
* | |
* Storefront application where user purchases ERC20, 721 and | |
* pays fees in the network's native fee curency. | |
* Modified version of community-points::transaction.js | |
* See also | |
* [email protected] | |
*/ |
This file contains 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
/* | |
* initDeliverable.js | |
* | |
* Storefront example application where user purchases ERC20, 721 and | |
* pays fees in the network's native fee curency. | |
* This is not a complete application, hence a gist. | |
* Modified version of community-points::transaction.js | |
* See also | |
* [email protected] | |
*/ |
This file contains 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
Working with Curve Source Repo, Including running from Brownie. | |
For starters, there is a pdf manual for brownie that should be found and utilized. | |
The way to configure the infura or whatever provider is via the command line, | |
in there you will want to set your mnemonic as well as your infura key or private RPC | |
$ brownie networks list true | |
$ brownie networks modify mainnet-fork mnemonic="\"your twelve word mnemonic\"" | |
$ brownie networks modify mainnet host=https://rinkeby.infura.io/v3/dklfjh0g8og8ohg845jhsgr98 |
This file contains 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 { DydxClient } = require('@dydxprotocol/v3-client') | |
const Web3 = require('web3') | |
const web31 = new Web3(process.env.RPC_NODE) | |
const web32 = new Web3(process.env.RPC_NODE) | |
const signer1 = web31.eth.accounts.wallet.add(process.env.TRADING_ZERO_PVT_KEY) | |
const signer2 = web32.eth.accounts.wallet.add(process.env.TRADING_ONE_PVT_KEY) | |
const { dateutils } = require('../utils') | |
const { iso8601, dateNowUTC, timeFmtDb } = dateutils |
This file contains 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
// load solana transactions into the database | |
const env = require('node-env-file') | |
env(__dirname + '/../.env') | |
const solscan = require('../external/solscan.js') | |
const { dbLocation, dbChainTx, dbChainTxSync, dbSplAccount, dbKnownWallets } = require('../db') | |
const { dateutils, decimals, signal, utils } = require('../utils') | |
const { timeFmtDb, dateNowUTC } = dateutils | |
const { weiToDisplay, bigD } = decimals |
This file contains 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
Using const { AlphaRouter } = require('@uniswap/smart-order-router') | |
when calling | |
const wei = ethers.utils.parseUnits('100', 6) | |
const inputAmount = CurrencyAmount.fromRawAmount(USDC, jsbi.BigInt(wei)) // Note inputAmount contains its own JSBI's created by uniswap code which appear to be the source of the error | |
const route = await router.route( | |
inputAmount, | |
UNI, | |
TradeType.EXACT_INPUT, | |
{ |