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

feat: Bid pricing based on USD scale #1385

Merged
merged 7 commits into from
Oct 1, 2021
Merged

feat: Bid pricing based on USD scale #1385

merged 7 commits into from
Oct 1, 2021

Conversation

arijitAD
Copy link
Contributor

This PR adds a script that uses the current USD price of an AKT to calculate the bid price.

Description

Motivation and Context

  • I have raised an issue to propose this change (required)
  • My issue has received approval from the maintainers or lead with the design/approved label

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@arijitAD arijitAD force-pushed the usd_pricing branch 2 times, most recently from bd032d8 to bb06714 Compare September 27, 2021 15:22
if [ $curl_exit_status != 0 ]; then
exit $curl_exit_status
fi
usd_per_akt=$(jq '."akash-network"."usd"' <<<"$API_RESPONSE")
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is just bidding do we want to fail here if the answer for this number is 0?

Copy link
Contributor

Choose a reason for hiding this comment

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

Think we should have a better backup then that, what if the oracle drops completely?

Copy link
Contributor

Choose a reason for hiding this comment

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

Up on line 65, if curl fails the script fails. No bid happens.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@hydrogen18
Copy link
Contributor

@boz since this is just a script should be put this in a separate repo?

@boz
Copy link
Contributor

boz commented Sep 27, 2021

@boz since this is just a script should be put this in a separate repo?

I think it's okay to add to script/ to use as a reference.

@arijitAD arijitAD force-pushed the usd_pricing branch 2 times, most recently from 4779275 to df9cea8 Compare September 29, 2021 06:14
})

go func() {
t.Error(http.ListenAndServe(addr, nil))
Copy link
Contributor

Choose a reason for hiding this comment

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

It is best to use port 0 and get an ephemeral port in tests.

We should also shut down the server before returning.

Copy link
Contributor Author

@arijitAD arijitAD Sep 30, 2021

Choose a reason for hiding this comment

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

Done. Added httptest server which random assigns a port.

Copy link
Contributor

@boz boz left a comment

Choose a reason for hiding this comment

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

🚀

@arijitAD arijitAD merged commit cbd9452 into master Oct 1, 2021
@arijitAD arijitAD deleted the usd_pricing branch October 1, 2021 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants