Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

feat: Unique quote ID#267

Closed
steveklebanoff wants to merge 4 commits intomasterfrom
feature/new-unique-id
Closed

feat: Unique quote ID#267
steveklebanoff wants to merge 4 commits intomasterfrom
feature/new-unique-id

Conversation

@steveklebanoff
Copy link
Copy Markdown
Contributor

Description

Hijacks the timestamp calldata to be treated as unique id: [10 random numbers][timestamp in seconds]

This will allow us to more easily attribute data in our data pipeline, and communicate unique ids for quotes to RFQT market makers

Testing Instructions

Checklist

  • Update documentation as needed. Website Documentation PR:
  • Prefix PR title with [WIP] if necessary.
  • Add tests to cover changes as needed.

// creates a random number of desired length by stringing together
// random integers from 1-9, guaranteeing the
// the .toString().length of the return value to equal to numberLength parameter
randomNumberOfLength: (numberLength: number): number => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know there are cooler and faster ways to achieve this (i.e. https://stackoverflow.com/a/3437180) but I wanted to guarantee that .toString().length = 10 so that we could correctly grab the following timestamp even in 300 years when unixTimestampInSeconds.toString().length is 11 😉

image

@steveklebanoff
Copy link
Copy Markdown
Contributor Author

Upon further review of the data pipeline, I'm going to push up some commits that revise this to take the nanoseconds + random modified approach as I believe this will make things easier on the postgres side

@alexkroeger alexkroeger changed the title [WIP] Unique ID feat: Unique quote ID Jul 10, 2020
@xianny xianny deleted the feature/new-unique-id branch March 30, 2021 22:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants