Skip to content

Instantly share code, notes, and snippets.

@bthaile
Last active August 28, 2019 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bthaile/99d9ee1082f340ea1b61280f13c6f4c9 to your computer and use it in GitHub Desktop.
Save bthaile/99d9ee1082f340ea1b61280f13c6f4c9 to your computer and use it in GitHub Desktop.

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"}

first profit loss log

{
  "_id": "10013127607.000000000018",
  "_rev": "1-893ff29afd0a0dc6e8dbd11ea428bc98",
  "account": "0x5FAD85B1e89d6a482705a7D04c0bEE70b6D227A5",
  "avgPrice": "0x28",
  "blockHash": "0x2c0e9bd2a277be78f6a19a891f46cdb7d54324a7a2417eac49b05eac47569489",
  "blockNumber": 13127607,
  "frozenFunds": "0x1bc16d674ec80000",
  "logIndex": 18,
  "market": "0x2626DA305c91d0535216a59d793f3330f829074F",
  "name": "ProfitLossChanged",
  "netPosition": "0xb1a2bc2ec50000",
  "outcome": "0x01",
  "realizedCost": "0x00",
  "realizedProfit": "0x00",
  "removed": false,
  "timestamp": "0x5d66c010",
  "topics": [
    "0x59543b7f82735782aa5bdb97dff40ff288d4548a5865da513b40e4088e2ee77e",
    "0x00000000000000000000000068629d2995fa8acd7d12d89d6c648dadd7a4ffae",
    "0x0000000000000000000000002626da305c91d0535216a59d793f3330f829074f",
    "0x0000000000000000000000005fad85b1e89d6a482705a7d04c0bee70b6d227a5"
  ],
  "transactionHash": "0x03ef9b843808aa28469acc7fcce1265ecbceb56ee3c7999484b3935ef0834de7",
  "transactionIndex": 0,
  "transactionLogIndex": 0,
  "universe": "0x68629D2995fA8aCd7D12d89d6C648dadd7a4fFae"
}
second trade
   short 10 at .31, cost 6.9 (as shown in order form)
{"_direction":"1","_market":"0x2626DA305c91d0535216a59d793f3330f829074F","_outcome":"1","_amount":"100000000000000000","_price":"31","_betterOrderId":"0x0000000000000000000000000000000000000000000000000000000000000000","_worseOrderId":"0x0000000000000000000000000000000000000000000000000000000000000000","_tradeGroupId":"0x663130643965632d666337372d343536642d393861632d613939643261646600","_loopLimit":"2","_affiliateAddress":"0x0000000000000000000000000000000000000000","_kycToken":"0x0000000000000000000000000000000000000000"}

second profit loss log

{
  "_id": "10013127632.000000000043",
  "_rev": "1-9cbb66f593fdea98ff5be024581cf532",
  "account": "0x5FAD85B1e89d6a482705a7D04c0bEE70b6D227A5",
  "avgPrice": "0x1f",
  "blockHash": "0xd5fdc837534834bee39625556304c213a8dad22adf91cf4a221a26bc36f60ec5",
  "blockNumber": 13127632,
  "frozenFunds": "0x2fe0dcb89b190000",
  "logIndex": 43,
  "market": "0x2626DA305c91d0535216a59d793f3330f829074F",
  "name": "ProfitLossChanged",
  "netPosition": "-0xb1a2bc2ec50000",
  "outcome": "0x01",
  "realizedCost": "0x1bc16d674ec80000",
  "realizedProfit": "-0x063eb89da4ed0000",
  "removed": false,
  "timestamp": "0x5d66c074",
  "topics": [
    "0x59543b7f82735782aa5bdb97dff40ff288d4548a5865da513b40e4088e2ee77e",
    "0x00000000000000000000000068629d2995fa8acd7d12d89d6c648dadd7a4ffae",
    "0x0000000000000000000000002626da305c91d0535216a59d793f3330f829074f",
    "0x0000000000000000000000005fad85b1e89d6a482705a7d04c0bee70b6d227a5"
  ],
  "transactionHash": "0xc5d3a0e9a23608f9fcd1b848fde75368cc7bf788aee841bf8bfde4ad32a21ee7",
  "transactionIndex": 0,
  "transactionLogIndex": 0,
  "universe": "0x68629D2995fA8aCd7D12d89d6C648dadd7a4fFae"
}

going short then long

YesNo market: `0x882A547Ff8BCac2E337fd219d0D71987dAd30b66`
first trade:
  short 5 @ 0.31 cost: 3.45 DAI

Profit and loss log

{
  "_id": "10013127435.000000000018",
  "_rev": "1-431d962e77ef992b0f5dff7a55937e2c",
  "account": "0x5FAD85B1e89d6a482705a7D04c0bEE70b6D227A5",
  "avgPrice": "0x1f",
  "blockHash": "0x0983e2ecaf9c8887724132bc2117636a0484ba3b43e22d710273518d4f7ffe56",
  "blockNumber": 13127435,
  "frozenFunds": "0x2fe0dcb89b190000",
  "logIndex": 18,
  "market": "0x882A547Ff8BCac2E337fd219d0D71987dAd30b66",
  "name": "ProfitLossChanged",
  "netPosition": "-0xb1a2bc2ec50000",
  "outcome": "0x01",
  "realizedCost": "0x00",
  "realizedProfit": "0x00",
  "removed": false,
  "timestamp": "0x5d66bd60",
  "topics": [
    "0x59543b7f82735782aa5bdb97dff40ff288d4548a5865da513b40e4088e2ee77e",
    "0x00000000000000000000000068629d2995fa8acd7d12d89d6c648dadd7a4ffae",
    "0x000000000000000000000000882a547ff8bcac2e337fd219d0d71987dad30b66",
    "0x0000000000000000000000005fad85b1e89d6a482705a7d04c0bee70b6d227a5"
  ],
  "transactionHash": "0x2ee45fb4b7e5e5ea8b5880a2f9cd04c22a2a47f9e9e90b61368d276263e0af89",
  "transactionIndex": 1,
  "transactionLogIndex": 0,
  "universe": "0x68629D2995fA8aCd7D12d89d6C648dadd7a4fFae"
}
second trade:
 long 10 @ 0.40 cost: 4.1 (what it says in order form)
{
  "_id": "10013127486.000000000050",
  "_rev": "1-3ab87157ab35c30c8c7b857d2f318a26",
  "account": "0x5FAD85B1e89d6a482705a7D04c0bEE70b6D227A5",
  "avgPrice": "0x29",
  "blockHash": "0x81f8d191cf45c157e98882f7f100f82c1bc20a3d1292bb90f20cf8fff6feb6d8",
  "blockNumber": 13127486,
  "frozenFunds": "0x1c7310237d8d0000",
  "logIndex": 50,
  "market": "0x882A547Ff8BCac2E337fd219d0D71987dAd30b66",
  "name": "ProfitLossChanged",
  "netPosition": "0xb1a2bc2ec50000",
  "outcome": "0x01",
  "realizedCost": "0x2fe0dcb89b190000",
  "realizedProfit": "-0x06f05b59d3b20000",
  "removed": false,
  "timestamp": "0x5d66be2c",
  "topics": [
    "0x59543b7f82735782aa5bdb97dff40ff288d4548a5865da513b40e4088e2ee77e",
    "0x00000000000000000000000068629d2995fa8acd7d12d89d6c648dadd7a4ffae",
    "0x000000000000000000000000882a547ff8bcac2e337fd219d0d71987dad30b66",
    "0x0000000000000000000000005fad85b1e89d6a482705a7d04c0bee70b6d227a5"
  ],
  "transactionHash": "0xf40fd612122b26fa640c5a4a2ac83666cf1615df64a10fff3da5c7b7a1e01128",
  "transactionIndex": 2,
  "transactionLogIndex": 0,
  "universe": "0x68629D2995fA8aCd7D12d89d6C648dadd7a4fFae"
}

going short then long works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment