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 #43: Adds support for ohcl and pair endpoints #44

Merged

Conversation

Micrograx
Copy link
Contributor

@Micrograx Micrograx commented Dec 11, 2023

Summary

This PR includes support for OHLC candles and dex pairs endpoints from the defi markets category

Type of Change

Please mark the relevant option(s) for your pull request:

  • 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 not work as expected)
  • Code refactoring (improving code quality without changing its behavior)
  • Documentation update (adding or updating documentation related to the project)

Checklist

Please ensure that your pull request meets the following criteria:

  • I have read the Contributing Guide
  • My code follows the project's coding style and best practices
  • My code is appropriately commented and includes relevant documentation
  • I have added tests to cover my changes
  • All new and existing tests pass
  • I have updated the documentation, if necessary

Testing

No new tests were added

Observations

The OHLC endpoint has more query parameters that were not included in this PR

@Micrograx Micrograx requested a review from a team as a code owner December 11, 2023 21:45
@sourabhxyz
Copy link
Contributor

Thanks @Micrograx for bringing this change :)

@@ -49,6 +49,7 @@ library
Maestro.API.V1.Addresses
Maestro.API.V1.Blocks
Maestro.API.V1.Datum
Maestro.API.V1.DefiMarkets
Copy link
Contributor

Choose a reason for hiding this comment

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

I would usually prefer just "Markets" as it matches exactly with path name but of course not a big deal.

toQueryParam = T.pack . show

-- | Because there is only one dex at the moment, the derivation returns "[]". This can be removed once support for a new dex is added.
instance FromJSON Dex where
Copy link
Contributor

Choose a reason for hiding this comment

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

JSON instances could have been conveniently derived using deriving-aeson like done here

-- | Denotes network for the entity in question, such as address.
data NetworkId = NIDMainnet | NIDTestnet
deriving stock (Show, Eq, Ord, Generic)
deriving (FromJSON, ToJSON) via CustomJSON '[ConstructorTagModifier '[StripPrefix "NID", LowerFirst]] NetworkId
.

, dexPairInfoCoinAPolicy :: PolicyId
, dexPairInfoCoinBAssetName :: TokenName
, dexPairInfoCoinBPolicy :: PolicyId
, dexPairInfoPair :: String
Copy link
Contributor

Choose a reason for hiding this comment

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

SDK is more inclined towards using Text.

@sourabhxyz
Copy link
Contributor

The PR looks really good, great work @Micrograx.

@Vardominator Could you merge it? I'll bring updated version with changelog & minor improvements in another PR.

@Vardominator Vardominator merged commit 7f4faa2 into maestro-org:main Dec 12, 2023
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.

3 participants