Vessel Finance API
  1. User
Vessel Finance API
  • Introduction
  • General Info
  • HMAC Signature Guide
  • Poseidon Signature Guide
  • Internal Transfer Signature Guide
  • Error Code
  • Vessel REST API
    • Public
      • Market Data
        • 24hr Ticker Statistics
        • Kline / Candlestick Data
        • Order Book
        • Recent Trades List
        • Average Price
        • AMM Pool Last 24h Data
      • Exchange Data
        • Ticker Info
        • Asset Info
        • Trade Fee
        • AMM Pool Info
    • User
      • Asset
        • User Asset
        • Withdraw
        • Withdraw History
        • Deposit History
        • Claim History
        • Internal Transfer (Send)
        • Internal Transfer History
      • Order
        • Place Order
        • Cancel Order
        • Open Orders
        • Completed Orders
        • All Orders
        • Query Order
        • Modify Order
      • AMM
        • Add Liquidity
        • Remove Liquidity
        • Collect Fee
        • AMM Position
        • AMM Action History
      • Account
        • User Profile
        • User Trade List
  • Vessel WebSocket
    • Market
      • Order Book
      • K Line
      • Recent Trades
      • 24hr Ticker Statistics
      • Ticker Setting Upade
    • User
      • Authorize
      • Balance
      • Account
  1. User

Balance

{{WSS_SERVER}}/ws/user
Last modified:2024-01-29 09:21:46
Balance is used to subscribe to real-time updates about user's account balances.
Before receiving real-time updates about your account balances through the "mybalance" channel, it's essential to subscribe to Authorize channel.

Update Speed#

Real-time

Message Structure#

Send Message#

1.
type: Specifies the type of WebSocket message.
1.
Type: String
2.
Value: "subscribe"
2.
channel: Indicates the type of data to subscribe to.
1.
Type: String
2.
Value: "mybalance"
3.
id: A unique identifier for the subscription request.
1.
Type: String
2.
Value: A randomly generated string or any unique identifier.

Subscribe Example#

{
    "type": "subscribe",
    "channel": "mybalance",
    "id": "random string"  
}

Unsubscribe Example#

{
    "type": "unsubscribe",
    "channel": "mybalance",
    "id": "random string"  
}
Upon sending a subscribe/unsubscribe message, you will receive a message indicating whether the subscription was successful or if there was an error. Additionally, the response will include the same ID that you included in your subscribe message, allowing you to match the response message to the specific subscribe request.

Response Example#

Initial Message#

1.
type: Specifies the type of WebSocket message. For "mybalance" channel, "init" means initialization, and "update" means an update.
1.
Type: String
2.
Value: "init"
2.
channel: Indicates the type of data to subscribe to.
1.
Type: String
2.
Value: "mybalance"
3.
assets: Contains the assets that have changes.
1.
assetName: The name of the asset(e.g., "USDT", or "WBTC").
1.
Type: String
2.
avalibale: The updated available balance of the asset after the event.
1.
Type: Number
3.
event: The type of event triggering the balance update.(e.g., INIT")
1.
Type: String
4.
inUse: The lowest price reached during the candlestick's duration.
1.
Type: Number

Response Example#

{
  "type": "init",
  "channel": "mybalance",
  "assets": 
  {
    "assetName": "USDT",
    "available": 18112.267984,
    "inUse": 47.562821,
    "event": "INIT"
  },
  {
    "assetName": "WBTC",
    "available": 18112,
    "inUse": 0,
    "event": "INIT"
  }
}

Update Message#

1.
type: Specifies the type of WebSocket message. For "mybalance" channel, "init" means initialization, and "update" means an update.
1.
Type: String
2.
Value: "init"
2.
channel: Indicates the type of data to subscribe to.
1.
Type: String
2.
Value: "mybalance"
3.
assets: Contains the assets that have changes.
1.
assetName: The name of the asset(e.g., "USDT", or "WBTC").
1.
Type: String
2.
avalibale: The updated available balance of the asset after the event.
1.
Type: Number
3.
event: The type of event triggering the balance update.(e.g., "ORDER_MATCH", "DEPOSIT", or "WITHDRAW")
1.
Type: String
4.
inUse: The lowest price reached during the candlestick's duration.
1.
Type: Number
5.
preAvailable: The available balance of the asset before the event occurred.
1.
Type: Number
6.
preInUse: The balance in use or reserved for open orders before the event occurred.
1.
Type: Number

Update Example#

Request

Header Params
VESSEL-API-KEY
string 
required
Default:
{{API_KEY}}
VESSEL-PASSPHRASE
string 
required
Default:
{{API_PASSPHRASE}}
VESSEL-SIGNATURE
string 
required
Use signRequest script to generate
VESSEL-TIMESTAMP
string 
required
Use signRequest script to set
Previous
Authorize
Next
Account
Built with