Implement getAccountTransactionHistory getter
See original GitHub issueCurrently in the UI, we are collecting user transactions over 4-5 endpoints, we need to consolidate this data into one new augur-node endpoint. This will allow Ui to clean up a lot of logic.
Input params:
universe
- universe in which to query for transactionsaccount
- user account address for which to find transactionsearliestTransactionTime
- earliest timestamp to filter bylatestTransactionTime
-latest timestamp to filter bycoin
- currency used in transactions (can be “ETH”, “REP”, or “ALL”)action
- type of transactions to get (can be “BUY”, “SELL”, “CANCEL”, “CLAIM_MARKET_CREATOR_FEES”, “CLAIM_PARTICIPATION_TOKENS”, “CLAIM_TRADING_PROCEEDS”, “CLAIM_WINNING_CROWDSOURCERS”, “DISPUTE”, INITIAL_REPORT", “MARKET_CREATION”, “COMPLETE_SETS”, or “ALL”)- standard sort parameters, such as
sortBy
,isSortDescending
,limit
, &offset
Output params:
action
: stringcoin
: stringdetails
: stringfee
: stringmarketDescription
: stringoutcome
: numberoutcomeDescription
: stringprice
: stringquantity
: stringtimestamp
: numbertotal
: stringtransactionHash
: string
Transaction types:
Action: Buy - queries the trades table for orders where the user created a buy order that got filled. * Price: trades.price * Quantity: trades.amount * Fees: trades.reporterFees + trades.marketCreatorFees * Total Revenue: trades.amount * (markets.maxPrice - trades.price)
Action: Sell - queries the trades table for orders where the user created a sell order that got filled. * Price: trades.price * Quantity: trades.amount * Fees: trades.reporterFees + trades.marketCreatorFees * Total Revenue: trades.amount * trades.price
Action: Canceled - queries the orders_canceled table for the user’s canceled orders. * Price: orders.price * Quantity: orders.amount * Fees: 0 * Total Revenue: 0
Action: Claim - queries crowdsourcer_redeemed, participation_token_redeemed, & trading proceeds tables. (Queries for claiming from market creator mailbox will be done in a separate ticket since this requires new AN code.) Crowdsourcer (REP): * Price: 0 * Quantity: 0 * Fees: 0 * Total Revenue: crowdsourcer_redeemed.repReceived Crowdsourcer (ETH): * Price: 0 * Quantity: 0 * Fees: 0 * Total Revenue: crowdsourcer_redeemed.reportingFeesReceived Participation Token: * Price: 0 * Quantity: 0 * Fees: 0 * Total Revenue: participation_token_redeemed.reportingFeesReceived Trading Proceeds: * Price: outcomes.price * Quantity: trading_proceeds.numShares * Fees: (trading_proceeds.numShares * outcomes.price) - trading_proceeds.numPayoutTokens * Total Revenue: trading_proceeds.numPayoutTokens Do we also need to show the REP amount redeemed for crowdsourcers & participation tokens, or just the profits?
Action: Dispute - queries disputes table for any dispute transactions where user is the reporter. * Price: 0 * Quantity: disputes.amountStaked * Fees: 0 * Total Revenue: 0
Action: Initial Report - queries initial_reports table for any initial reports where user is the reporter. * Price: 0 * Quantity: initial_reports.amountStaked * Fees: 0 * Total Revenue: 0
Action: Market Finalization - would require additional AN code. Not a high priority, so probably will be done only for v2.
Action: Market Creation - queries markets table for all markets where user is marketCreator. (Only returns ETH validity bond txs; does not return no-show REP bond txs since this info is not in the logs.) * Price: 0 * Quantity: 0 * Fees: markets.creationFee * Total Revenue: 0
Action: Complete Sets - queries completeSets table where account is user. Buying: * Price: markets.numTicks * Quantity: completeSets.numCompleteSets * Fees: 0 * Total Revenue: 0 Selling: * Price: markets.numTicks * Quantity: completeSets.numCompleteSets * Fees: (reporting fee rate * price * quantity) + (creator fee rate * price * quantity) * Total Revenue: (completeSets.numCompleteSets * markets.numTicks) - fees
We also need pagination like the other getters. This response from this getter will populate this transactions modal:
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
I’ll tackle this this week!
@Chwy5 I discussed the participation token txs with Alex, and he said we don’t have a good way to get the buy participation token txs from the DB right now, and they aren’t necessary for tax purposes anyway, so I’ll leave those out. For the claim participation token txs, he said the cost basis should be 0, and the total should just be the reporting fees the user got.