Skip to content

Instantly share code, notes, and snippets.

View joeykrug's full-sized avatar
🎯
Focusing

Joseph Krug joeykrug

🎯
Focusing
View GitHub Profile
[Log] (augur~5a11b65b.4b0b5a17b0971858e35d.js, line 1)
*******************************************
DEBUGGING INFO
*******************************************
BUILD INFORMATION
commit -- 0909806e493bf78f99df53993a9160bea0ae280a
-- https://github.com/AugurProject/augur/commit/0909806e493bf78f99df53993a9160bea0ae280a
network -- mainnet
-------------------------------------------
[Log] (augur~5a11b65b.4b0b5a17b0971858e35d.js, line 1)
*******************************************
DEBUGGING INFO
*******************************************
BUILD INFORMATION
commit -- 0909806e493bf78f99df53993a9160bea0ae280a
-- https://github.com/AugurProject/augur/commit/0909806e493bf78f99df53993a9160bea0ae280a
network -- mainnet
-------------------------------------------
@joeykrug
joeykrug / log
Created August 3, 2020 18:55
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 / sorting.py
Last active August 1, 2019 18:19
Liquidity ranking
### 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 / index.js
Created July 14, 2019 01:12
index file for pubsub
/* 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')
@joeykrug
joeykrug / node_bundle.js
Created July 14, 2019 01:11
Node creation
'use strict'
const PeerInfo = require('peer-info')
const Node = require('./browser-bundle')
function createNode (callback) {
PeerInfo.create((err, peerInfo) => {
if (err) {
return callback(err)
}
@joeykrug
joeykrug / browserbundle.js
Created July 14, 2019 01:11
libp2p bundle
'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 / sortalgo.js
Last active May 24, 2019 01:12
ryan algo mod w/ comments
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 February 13, 2019 01:31
Profit and loss calcs for augur
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
pragma solidity ^0.4.11;
import './StandardToken.sol';
import './Ownable.sol';
import './ERC20Basic.sol';
/**
* @title Mintable token