Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Joseph Krug joeykrug

🎯
Focusing
View GitHub Profile
View gist:2429ce53685b9b702e6496dadc68787c
[Log] (augur~5a11b65b.4b0b5a17b0971858e35d.js, line 1)
*******************************************
DEBUGGING INFO
*******************************************
BUILD INFORMATION
commit -- 0909806e493bf78f99df53993a9160bea0ae280a
-- https://github.com/AugurProject/augur/commit/0909806e493bf78f99df53993a9160bea0ae280a
network -- mainnet
-------------------------------------------
View gist:d3141cebbb5febbda9ded52968a2e12f
[Log] (augur~5a11b65b.4b0b5a17b0971858e35d.js, line 1)
*******************************************
DEBUGGING INFO
*******************************************
BUILD INFORMATION
commit -- 0909806e493bf78f99df53993a9160bea0ae280a
-- https://github.com/AugurProject/augur/commit/0909806e493bf78f99df53993a9160bea0ae280a
network -- mainnet
-------------------------------------------
View log
[Log] (augur~5a11b65b.4b0b5a17b0971858e35d.js, line 1)
*******************************************
DEBUGGING INFO
*******************************************
BUILD INFORMATION
commit -- 0909806e493bf78f99df53993a9160bea0ae280a
-- https://github.com/AugurProject/augur/commit/0909806e493bf78f99df53993a9160bea0ae280a
network -- mainnet
-------------------------------------------
@joeykrug
joeykrug / index.js
Created Jul 14, 2019
index file for pubsub
View index.js
/* eslint no-console: ["error", { allow: ["log"] }] */
/* eslint max-nested-callbacks: ["error", 5] */
'use strict'
// would publish every 24 hr and also publish on connection to a new peer
const domReady = require('detect-dom-ready')
const createNode = require('./create-node')
const FloodSub = require('libp2p-floodsub')
View node_bundle.js
'use strict'
const PeerInfo = require('peer-info')
const Node = require('./browser-bundle')
function createNode (callback) {
PeerInfo.create((err, peerInfo) => {
if (err) {
return callback(err)
}
View browserbundle.js
'use strict'
const WebRTCStar = require('libp2p-webrtc-star')
const WebSockets = require('libp2p-websockets')
const FloodSub = require('libp2p-floodsub')
const WebSocketStar = require('libp2p-websocket-star')
const Mplex = require('libp2p-mplex')
const SPDY = require('libp2p-spdy')
const SECIO = require('libp2p-secio')
const Bootstrap = require('libp2p-bootstrap')
@joeykrug
joeykrug / sorting.py
Last active Aug 1, 2019
Liquidity ranking
View sorting.py
### INVALID FILTER:
Get 0x bids (remove all bids where gas fees are > 1% of the trade's value, we should do this for all books on augur in v2)
valid_revenue = best_bid_quantity*range*(1-reporter_fee-creator_fee)*e^(-.15*time_til_market_finalizes_in_years) - gasToDoATrade - gasToClaimWinnings
valid_cost = best_bid_quantity * (max - best_bid)
valid_profit = valid_revenue - valid_cost
if valid_profit >= 0:
show_market
else:
@joeykrug
joeykrug / sortalgo.js
Last active May 24, 2019
ryan algo mod w/ comments
View sortalgo.js
def getLiquidityTokens(marketId, outcome, spreadPercent) {
// we adjust for fees by ask / (1 + totalFee%) and bid / (1 - totalFee%)
// also the share price should be converted to non display prices so a scalar from -100 to 200, -100 would be 0, 200 would be 300.
const orderBook = feeAdjust(sharePrice(select *
from orders where marketId and outcome));
// also add orders to the book for infinite liquidity (so maybe just whatever the biggest js value is) at the min and max, for bids we add it at the min, for asks we add it at the max
let liquidityTokens = 0 eth; // ie. proceeds from selling complete sets
let liquidityTokenCost = 0 eth; // ie. cost for complete sets
const sellIncrementQuantity = numCompleteSetsForNEthTokens(
SELL_INCREMENT_COST
@joeykrug
joeykrug / pnl.py
Last active Feb 13, 2019
Profit and loss calcs for augur
View pnl.py
Whenever user does a trade of trade(outcome, price, amount) (regardless if due to getting filled or them doing a taker order):
# amount owned is display amount, raw is raw amount
# prior means prior to a trade
Goto (goto considered harmful but screw it this is pseudocode) outcome in UI:
if(amount > 0):
if(amount_owned >= 0):
amount_of_shares_closed = 0
prior_shares_remaining = amount_owned
View gist:3207c8f0b29441f87f0834def918d187
pragma solidity ^0.4.11;
import './StandardToken.sol';
import './Ownable.sol';
import './ERC20Basic.sol';
/**
* @title Mintable token
You can’t perform that action at this time.