This repo contains sample scripts in various languages. These scripts use the Vega core and wallet APIs to interact with Vega core nodes and wallet servers.
Get started with the sample API scripts with zero configuration. Click on the "Gitpod ready-to-code" button above.
- Copy or rename the
credentials-template
file ascredentials
.
Note: When running on Gitpod this is already done for you. - Edit the
credentials
file. (nano
andvim
are installed, or use the built-in Gitpod text editor.) - Import the credentials into your local environment:
source credentials
And you're good to go. Now choose a sample program to run from the following (see the link in the Folder column to learn how to run each sample script):
Script description | Languages | API transport | Folder & README |
---|---|---|---|
Get Asset | python3, go | Vega node [GraphQL, REST, gRPC] | / get-assets |
Orders by reference | bash, python3, go | Vega node [GraphQL, REST, gRPC] | / get-by-reference |
List market details and market data | bash, python3, go | Vega node [GraphQL, REST, gRPC] | / get-markets-and-market-data |
List Vega network parameters | bash, python3, go | Vega node [GraphQL, REST, gRPC] | / get-netowork-parameters |
List orders and trades | bash, python3, go | Vega node [GraphQL, REST, gRPC] | / get-orders-and-trades |
Vega statistics | bash, python3, go | Vega node [GraphQL, REST, gRPC] | / get-statistics |
List parties and accounts | bash, python3, go | Vega node [REST, gRPC] | / parties-and-accounts |
Stream events | python3, go | Vega node [GraphQL, REST, gRPC] | / stream-events |
Stream market data | python3, go | Vega node [GraphQL] | / stream-marketdata |
Stream orders and trades | python3, go | Vega node [GraphQL] | / stream-orders-and-trades |
Interact with Vega wallet API | bash, python3, go | Vega wallet [REST] | / wallet |
Submit, amend and cancel orders | bash, python3, go | Vega wallet [REST], Vega node [REST, gRPC] | / submit-amend-cancel-orders |
Submit and amend pegged orders | bash, python3, go | Vega wallet [REST], Vega node [REST, gRPC] | / submit-amend-pegged-order |
Submit order (tutorial, inc send tx) | bash, python3, go | Vega wallet [REST], Vega node [REST, gRPC] | / submit-order |
Vega/blockchain time | bash, python3, go | Vega node [GraphQL, REST, gRPC] | / vega-time |
Streaming events | bash, python3, go | Vega node [GraphQL, gRPC] | / stream-events |
Fees and margins estimation | bash, python3, go | Vega node [REST, gRPC] | / fees-margins-estimation |
Propose, vote and enact new markets | bash, python3 | Vega node [REST] | / propose-markets |
List proposals | bash, python3, go | Vega node [GraphQL, gRPC] | / propose-votes |
Python/terminal: If you get No module named 'helpers'...
, you should enter source credentials
and check with echo "$PYTHONPATH"
than it shows "."
.
Please reach out to us on the community forums or Discord chat to enquire further about how to get involved with Vega.
If you have found an issue or would like to suggest an improvement with our public code samples, please raise an issue in the Sample-API-Scripts repository. If you'd like to submit a PR we welcome additional sample code.