Skip to content

Instantly share code, notes, and snippets.

View bthaile's full-sized avatar

Tom Haile bthaile

  • code slinger
View GitHub Profile

First example user goes long then short.

market: 0x2626DA305c91d0535216a59d793f3330f829074F
first trade 
  long 5 at 0.4, cost 2
{"_direction":"0","_market":"0x2626DA305c91d0535216a59d793f3330f829074F","_outcome":"1","_amount":"50000000000000000","_price":"40","_betterOrderId":"0x0000000000000000000000000000000000000000000000000000000000000000","_worseOrderId":"0x0000000000000000000000000000000000000000000000000000000000000000","_tradeGroupId":"0x656236663431332d633535612d343963642d386364652d333065623838363200","_loopLimit":"2","_affiliateAddress":"0x0000000000000000000000000000000000000000","_kycToken":"0x0000000000000000000000000000000000000000"}
@bthaile
bthaile / gist:c0c8290ba6fce0f880757d3aba743900
Created July 27, 2019 15:09
WS payload received for Jimmy
{id: "a0f41b2c42c747b49064aee66e7ccc79", status: "LOAD_CRP",…}
id: "a0f41b2c42c747b49064aee66e7ccc79"
payload: [{Id: 0, DocumentId: "FvfPjyvzYLfsZaTpI9GY", Created: "2019-07-27T12:00:03.886714Z",…},…]
0: {Id: 0, DocumentId: "FvfPjyvzYLfsZaTpI9GY", Created: "2019-07-27T12:00:03.886714Z",…}
1: {Id: 0, DocumentId: "htHcZrwfddWGyCIiMkyO", Created: "2019-07-27T11:59:46.949218Z",…}
2: {Id: 0, DocumentId: "KQNReTm9awQ0utoyfbpH", Created: "2019-07-26T12:18:49.879107Z",…}
3: {Id: 0, DocumentId: "iFfmABLWX1uNNBL0VXXR", Created: "2019-07-26T12:18:53.035363Z",…}
4: {Id: 0, DocumentId: "PkfWA5oUtEOSqoUvvwbs", Created: "2019-07-25T12:32:27.366528Z",…}
5: {Id: 0, DocumentId: "szr9szUMJ24f5JYyabX5", Created: "2019-07-24T10:59:01.33505Z",…}
6: {Id: 0, DocumentId: "USskBNHZJBr7shVJFxCi", Created: "2019-07-24T10:59:01.428796Z",…}
@bthaile
bthaile / gist:63d3b249dafae5487ecd2061c0c7897a
Created July 17, 2019 19:03
Cannot read property 'rollback' of undefined
DB.ts?b8fd:315 Uncaught (in promise) TypeError: Cannot read property 'rollback' of undefined
at DB.eval (DB.ts?b8fd:315)
at step (DB.js:32)
at Object.eval [as next] (DB.js:13)
at fulfilled (DB.js:4)
(anonymous) @ DB.ts?b8fd:315
step @ DB.js:32
(anonymous) @ DB.js:13
fulfilled @ DB.js:4
Promise.then (async)
@bthaile
bthaile / gist:cd8c058c37d2fc2ab13cbc093cc4e2ec
Created July 17, 2019 18:44
TypeError: Cannot read property 'sync' of undefined
Uncaught (in promise) TypeError: Cannot read property 'sync' of undefined
at DB.eval (DB.ts?b8fd:204)
at step (DB.js:32)
at Object.eval [as next] (DB.js:13)
at fulfilled (DB.js:4)
(anonymous) @ DB.ts?b8fd:204
step @ DB.js:32
(anonymous) @ DB.js:13
fulfilled @ DB.js:4
Promise.then (async)
@bthaile
bthaile / uncaught promise
Created July 17, 2019 18:29
document conflict in derived db, Markets
DerivedDB.js:18 Uncaught (in promise)
CustomPouchError {status: 409, name: "conflict", message: "Document update conflict", error: true, id: "104-Markets", …}
rejected @ DerivedDB.js:18
Promise.then (async)
step @ DerivedDB.js:19
fulfilled @ DerivedDB.js:17
Promise.then (async)
step @ DerivedDB.js:19
fulfilled @ DerivedDB.js:17
Promise.then (async)
@bthaile
bthaile / unable to add new block
Created July 17, 2019 18:27
error after sending tx to take partial order from book
DerivedDB.ts?2f8f:114 Uncaught (in promise) Error: Unable to add new block
at MarketDB.eval (DerivedDB.ts?2f8f:114)
at step (DerivedDB.js:45)
at Object.eval [as next] (DerivedDB.js:26)
at fulfilled (DerivedDB.js:17)
(anonymous) @ DerivedDB.ts?2f8f:114
step @ DerivedDB.js:45
(anonymous) @ DerivedDB.js:26
fulfilled @ DerivedDB.js:17
Promise.then (async)
@bthaile
bthaile / NOT NULL constraint
Last active May 15, 2019 20:51
augur app 1.13 error when trying to sync mainnet
[14:49:14.772] augur-node start: insert into `_knex_temp_alter7` (`account`, `blockNumber`, `eventName`, `logIndex`, `marketId`, `numCompleteSets`, `numPurchasedOrSold`, `tradeGroupId`, `transactionHash`, `universe`) select '0x2404a39e447d0c8b417049fc42b468a26990b4cc' as `account`, 5970747 as `blockNumber`, 'CompleteSetsSold' as `eventName`, 53 as `logIndex`, '0x62fd1c486b124404e863354ac6a32d348ee074b0' as `marketId`, "3" as `numCompleteSets`, '3' as `numPurchasedOrSold`, NULL as `tradeGroupId`, '0xc00edbcad96cc73cc3843c9a8761c9915d026d7b18d212053ffac142a186c8f2' as `transactionHash`, '0xe991247b78f937d7b69cfc00f1a487a293557677' as `universe` union all select '0x2404a39e447d0c8b417049fc42b468a26990b4cc' as `account`, 5970756 as `blockNumber`, 'CompleteSetsSold' as `eventName`, 84 as `logIndex`, '0x62fd1c486b124404e863354ac6a32d348ee074b0' as `marketId`, "3" as `numCompleteSets`, '3' as `numPurchasedOrSold`, NULL as `tradeGroupId`, '0xa0c6da53b221a26c4a649c9deae239b20c1bd139e1caf7b12ecab7d70b47e38a' as `transa
@bthaile
bthaile / augur-node response
Created April 12, 2019 15:10
augur-node getUser positions
{"tradingPositions":[{"position":"0.0011101","marketId":"0x448d1d8280844513c38b2b73bde8a539d0022954","outcome":1,"timestamp":1555076658,"netPosition":"0.0012101","realized":"0","unrealized":"-0.000021353000000000000005267","total":"-0.000021353000000000000005267","averagePrice":"0.18764564911990744567","unrealizedCost":"0.000227070000000000000005267","realizedCost":"0","totalCost":"0.000227070000000000000005267","realizedPercent":"0","unrealizedPercent":"-0.09403708107632007753","totalPercent":"-0.09403708107632007753","unrealizedRevenue":"0.000205717","frozenFunds":"0.00022707","lastTradePrice":"0.17","lastTradePrice24hAgo":"0.5","lastTradePrice24hChangePercent":"-0.66","unrealizedRevenue24hAgo":"0.00060505","unrealizedRevenue24hChangePercent":"-0.66"},{"position":"0","marketId":"0xdc0f132b0691bd9b89af038bf29e7e19ab7a5445","outcome":1,"timestamp":1555076658,"netPosition":"0","realized":"0.0009990030934","unrealized":"0","total":"0.0009990030934","averagePrice":"-10","unrealizedCost":"0","realizedCost":"0.009
40,"jsonrpc":"2.0","method":"getMarkets","params":{"reportingState":["FINALIZED","AWAITING_FINALIZATION"],"sortBy":"endTime","isSortDescending":true,"universe":"0x3d777ea1541a7dec004972b283d53af3633b7531"}}
{"id":30041,"jsonrpc":"2.0","method":"getMarkets","params":{"reportingState":["FINALIZED","AWAITING_FINALIZATION"],"sortBy":"endTime","isSortDescending":true,"universe":"0x3d777ea1541a7dec004972b283d53af3633b7531"}}
{"id":30042,"jsonrpc":"2.0","method":"getMarkets","params":{"reportingState":["FINALIZED","AWAITING_FINALIZATION"],"sortBy":"endTime","isSortDescending":true,"universe":"0x3d777ea1541a7dec004972b283d53af3633b7531"}}
{"id":30043,"jsonrpc":"2.0","method":"getMarkets","params":{"reportingState":["FINALIZED","AWAITING_FINALIZATION"],"sortBy":"endTime","isSortDescending":true,"universe":"0x3d777ea1541a7dec004972b283d53af3633b7531"}}
<--- Last few GCs --->
[717:0x103002a00] 872426 ms: Mark-sweep 1332.9 (1441.0) -> 1306.4 (1434.4) MB, 873.4 / 0.0 ms (average mu = 0.300, current mu = 0.309) alloca
[bthaile@mbp:~/gitrepos/augur (petong/docker-node-alpine *)]$ yarn workspace augur-node start
yarn workspace v1.12.3
yarn run v1.12.3
$ ts-node ./src/runServer
connecting to augur-node: undefined
connecting to ethereum-node: {"http":"http://localhost:8545","ws":"ws://localhost:8546"}
websocket ws://localhost:8546 opened
connected to ethereum
augur-102-3.db
Starting websocket secure server on port 9002