Skip to content

avianlabs/paxos-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for paxos

Welcome to Paxos APIs. At Paxos, our mission is to enable the movement of any asset, any time, in a trustworthy way. These APIs serve that mission by making it easier than ever for you to directly integrate our product capabilities into your application, leveraging the speed, stability, and security of the Paxos platform.

The documentation that follows gives you access to our Crypto Brokerage, Trading, and Exchange products. It includes APIs for market data, orders, and the held rate quote flow.

To test in our sandbox environment, sign up for an account. For more information about Paxos and our APIs, visit Paxos.com.

Generation

This SDK is generated from the OpenAPI spec found here.

The CLI command to generate it was:

openapi-generator generate -i paxos-v2.openapi.json -g go --package-name paxos --git-user-id avianlabs --git-repo-id paxos-go -t ./templates

Templates

The default generation will fail with this OpenAPI spec because there are enums with duplicate names. To solve this I've had to alter enum generation to suffix the datatype.

To do this, first we downloaded templates with the following command:

openapi-generator author template -g go -o ./templates

Then I updated the relevant template. In this case it was 'model_enum.mustache'. We instruct the generator to use our template using -t <templates folder>.

Changes post generation

  1. Revert changes to README.md so as not to loose these instructions!
  2. Revert changes to go.mod to keep generated code using specific go version and dependency versions.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 2.0
  • Package version: 1.0.0
  • Generator version: 7.6.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import paxos "github.com/avianlabs/paxos-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value paxos.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), paxos.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value paxos.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), paxos.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using paxos.ContextOperationServerIndices and paxos.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), paxos.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), paxos.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://api.paxos.com/v2

Class Method HTTP request Description
AccountMembersAPI AddAccountMembers Post /identity/account-members Add Account Members
AccountMembersAPI DeleteAccountMember Delete /identity/account-members/{id} Remove Account Member
AccountsAPI CreateAccount Post /identity/accounts Create Account
AccountsAPI GetAccount Get /identity/accounts/{id}
AccountsAPI ListAccounts Get /identity/accounts List Accounts
AccountsAPI UpdateAccount Put /identity/accounts Update Account
CryptoWithdrawalsAPI CreateCryptoWithdrawal Post /transfer/crypto-withdrawals Create Crypto Withdrawal
DepositAddressesAPI CreateDepositAddress Post /transfer/deposit-addresses Create Deposit Address
DepositAddressesAPI ListDepositAddresses Get /transfer/deposit-addresses List Deposit Addresses
ExchangePublicAPI ListProfileExecutions Get /profiles/{profile_id}/executions List Executions
ExchangePublicAPI ListProfileOrders Get /profiles/{profile_id}/orders List Orders
FeesAPI CreateCryptoWithdrawalFee Post /transfer/fees/crypto-withdrawal Create Crypto Withdrawal Fee
FiatTransfersAPI CreateFiatAccount Post /transfer/fiat-accounts Create Fiat Account
FiatTransfersAPI CreateFiatDepositInstructions Post /transfer/fiat-deposit-instructions Create Fiat Deposit Instructions
FiatTransfersAPI CreateFiatWithdrawal Post /transfer/fiat-withdrawals Create Fiat Withdrawal
FiatTransfersAPI DeleteFiatAccount Delete /transfer/fiat-accounts/{id} Delete Fiat Account
FiatTransfersAPI GetFiatAccount Get /transfer/fiat-accounts/{id} Get Fiat Account
FiatTransfersAPI GetFiatDepositInstructions Get /transfer/fiat-deposit-instructions/{id} Get Fiat Deposit Instructions
FiatTransfersAPI ListFiatAccounts Get /transfer/fiat-accounts List Fiat Accounts
FiatTransfersAPI ListFiatDepositInstructions Get /transfer/fiat-deposit-instructions List Fiat Deposit Instructions
FiatTransfersAPI UpdateFiatAccount Put /transfer/fiat-accounts/{id} Update Fiat Account
IdentityAPI CreateIdentity Post /identity/identities Create Identity
IdentityAPI GetIdentity Get /identity/identities/{id} Get Identity
IdentityAPI ListIdentities Get /identity/identities List Identities
IdentityAPI UpdateIdentity Put /identity/identities/{id} Update Identity
IdentityCredentialsAPI RetryIdVerification Post /identity/identities/{id}/retry-id-verification Retry Id Verification
IdentityCredentialsAPI SetVerifierCredentials Post /identity/verifier-credentials Set Verifier Credentials
IdentityDocumentsAPI DocumentUpload Put /identity/identities/{identity_id}/documents Document Upload
IdentityDocumentsAPI ListIdentityDocuments Get /identity/identities/{identity_id}/documents List Identity Documents
InstitutionMembersAPI AddInstitutionMembers Post /identity/institution-members Add Institution Members
InstitutionMembersAPI DeleteInstitutionMember Delete /identity/institution-members/{id} Remove Institution Member
InternalTransfersAPI CreateInternalTransfer Post /transfer/internal Create Internal Transfer
LimitsAPI ListTransferLimits Get /transfer/limits/utilizations List Transfer Limits
MarketDataAPI GetOrderBook Get /markets/{market}/order-book Get Order Book
MarketDataAPI GetTicker Get /markets/{market}/ticker Get Ticker
MarketDataAPI ListMarkets Get /markets List Markets
MarketDataAPI ListRecentExecutions Get /markets/{market}/recent-executions List Recent Executions
OrdersAPI CancelOrder Delete /profiles/{profile_id}/orders/{id} Cancel Order
OrdersAPI CreateOrder Post /profiles/{profile_id}/orders Create Order
OrdersAPI GetOrder Get /profiles/{profile_id}/orders/{id} Get Order
OrdersAPI ListExecutions Get /executions List Executions
OrdersAPI ListOrders Get /orders List Orders
PricingAPI ListHistoricalPrices Get /markets/{market}/historical-prices List Historical Prices
PricingAPI ListPrices Get /all-markets/prices List Prices
PricingAPI ListTickers Get /all-markets/ticker List Tickers
ProfilesAPI CreateProfile Post /profiles Create Profile
ProfilesAPI GetProfile Get /profiles/{profile_id} Get Profile
ProfilesAPI GetProfileBalance Get /profiles/{profile_id}/balances/{asset} Get Profile Balance
ProfilesAPI ListProfileBalances Get /profiles/{profile_id}/balances List Profile Balances
ProfilesAPI ListProfiles Get /profiles List Profiles
QuoteExecutionsAPI CreateQuoteExecution Post /profiles/{profile_id}/quote-executions Create Quote Execution
QuoteExecutionsAPI GetQuoteExecution Get /profiles/{profile_id}/quote-executions/{id} Get Quote Execution
QuoteExecutionsAPI ListQuoteExecutions Get /profiles/{profile_id}/quote-executions List Quote Executions
QuotesAPI ListQuotes Get /quotes List Quotes
SandboxDepositsAPI CreateSandboxDeposit Post /sandbox/profiles/{profile_id}/deposit Create Sandbox Deposit
SandboxFiatTransfersAPI InitiateSandboxFiatDeposit Post /sandbox/fiat-deposits Initiate Sandbox Fiat Deposit
SandboxIdentityAPI SandboxSetIdentityStatus Put /identity/identities/{id}/sandbox-status Sandbox Set Identity Status
StablecoinConversionAPI CancelStablecoinConversion Delete /conversion/stablecoins/{id} Cancel Stablecoin Conversion
StablecoinConversionAPI CreateStablecoinConversion Post /conversion/stablecoins Create Stablecoin Conversion
StablecoinConversionAPI GetStablecoinConversion Get /conversion/stablecoins/{id} Get Stablecoin Conversion
StablecoinConversionAPI ListStablecoinConversions Get /conversion/stablecoins List Stablecoin Conversions
TaxFormsAPI ListTaxFormRevisions Get /tax/tax-form-revisions List Tax Form Revisions
TaxFormsAPI ListTaxForms Get /tax/tax-forms List Tax Forms
TaxLotAPI GetTaxLot Get /tax/tax-lots/{id} Get Tax Lot
TaxLotAPI ListTaxLots Get /tax/tax-lots List Tax Lots
TaxLotAPI UpdateTaxLot Put /tax/tax-lots/{id} Update Tax Lot
TransfersAPI GetTransfer Get /transfer/transfers/{id} Get Transfer
TransfersAPI ListTransfers Get /transfer/transfers List Transfers

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

OAuth2

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes:
  • funding:read_profile: Read profile and balance data
  • exchange:read_quote: Read quotes and quote history
  • exchange:write_quote_execution: Execute on quoted prices
  • exchange:read_quote_execution: Read quote executions
  • exchange:write_order: Create and Cancel Orders
  • exchange:read_order: Read Orders and Executions
  • exchange:historical_prices: Read Historical Pricing Data
  • transfer:read_transfer: Read deposit and withdrawal transfers
  • transfer:read_deposit_address: Read deposit addresses
  • transfer:write_deposit_address: Create and manage deposit addresses
  • fee:write_crypto_withdrawal_fee: Create crypto withdrawal fees
  • transfer:write_crypto_withdrawal: Create crypto withdrawal transfers
  • conversion:read_conversion_stablecoin: Retrieve requested or completed conversions
  • conversion:write_conversion_stablecoin: Create or cancel a conversion request

Example

auth := context.WithValue(context.Background(), paxos.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, paxos.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published