Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flip/Trade entity #29

Open
vikiival opened this issue Jul 4, 2023 · 4 comments
Open

Flip/Trade entity #29

vikiival opened this issue Jul 4, 2023 · 4 comments
Labels
schema Requires changing schema

Comments

@vikiival
Copy link
Member

vikiival commented Jul 4, 2023

To make some trading views easier the optional path is to make a Trade entity like following

type TradeEntity @entity {
  id: ID!
  nft: NFTEntity!
  createdAt: DateTime!
  closedAt: DateTime!
  initialPrice: BigInt!
  closingPrice: BigInt!
  realized: BigInt!
  percent: Int!
  profit: Boolean!
  issuer: String!
  buyer: String! 
}

May @daiagi can have more information since he was working on Flipper UI in Kodadot

@vikiival vikiival added the schema Requires changing schema label Jul 4, 2023
@vikiival
Copy link
Member Author

vikiival commented Jul 4, 2023

  • maybe add how much fee + royalty was paid?

@daiagi
Copy link

daiagi commented Jul 4, 2023

here is the data shape currently created on client side

getting all the flip events on a collection from squid is good enough, as the rest is simple summation
obv for a flip event we will need also the flipper id, which is the address that bought and then later sold (i.e the nft got bought from him/her/it) an nft
a person who got the nft for free (minter or a sendee) is not counted as flipper

export type FlipEvent = {
  nft: NFTExcludingEvents
  soldPrice: number
  soldTo: string
  sellTimeStamp: number
  boughtPrice: number
  profit: number
}

export type Flippers = {
  [identity: string]: {
    flips: FlipEvent[]
    owned: number
    totalBought: number
    totalsold: number
    bestFlip: number
    latestflipTimestamp: number
  }
}

@vikiival
Copy link
Member Author

vikiival commented Jul 4, 2023

getting all the flip events on a collection from squid is good enough

But not effective imho, you still need to iterate over buys or so

flipper id, which is the address that bought and then later sold

Marked as caller in the schema

a person who got the nft for free (minter or a sendee) is not counted as flipper

Yup otherwise it would be always 100% profit

@daiagi
Copy link

daiagi commented Jul 4, 2023

But not effective imho, you still need to iterate over buys or so

absolutely, getting it all nice and organized straight from Mr.squid would be ideal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
schema Requires changing schema
Projects
None yet
Development

No branches or pull requests

2 participants