baldator / sample-api-scripts

Sample API scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gitpod ready-to-code

Sample API scripts

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.

Gitpod

Get started with the sample API scripts with zero configuration. Click on the "Gitpod ready-to-code" button above.

Getting started

  1. Copy or rename the credentials-template file as credentials.
    Note: When running on Gitpod this is already done for you.
  2. Edit the credentials file. (nano and vim are installed, or use the built-in Gitpod text editor.)
  3. 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):

Sample scripts

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

Troubleshooting

Python/terminal: If you get No module named 'helpers'..., you should enter source credentials and check with echo "$PYTHONPATH" than it shows ".".

Contributing or raising issues

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.

About

Sample API scripts

License:MIT License


Languages

Language:Python 46.5%Language:Go 34.0%Language:Shell 19.4%Language:PowerShell 0.1%Language:Dockerfile 0.0%