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

Account

Developing
{{WSS_SERVER}}/ws/user
Last modified:2024-10-12 09:33:48
Account is used to subscribe to real-time updates about user's account changes.
Before receiving real-time updates about your account changes through the "myaccount" 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: "myaccount"
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": "myaccount",
    "id": "random string"  
}

Unsubscribe Example#

{
    "type": "unsubscribe",
    "channel": "myaccount",
    "id": "random string"  
}

Response Message#

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#

Initial response includes information about account details, assets, open orders, deposits, and withdrawals.
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: "myaccount"
3.
timestamp: Specifies the timestamp of the channel is subscribed.
1.
Type: String (UNIX timestamp in milliseconds & UTC)
2.
Example: "1705642544624"
4.
account: Contains the information of this user.
1.
vesselApiKey: An array containing the vessel API keys associated with the user's account.
1.
Type: Array
2.
vesselPublicKey: The public key associated with the user's vessel.
1.
Type: String
5.
assets: An array containing information about the user's assets.
1.
assetName: The name of the asset(e.g., "USDT", or "WBTC").
1.
Type: String
2.
avalibale: The initial available balance of the asset.
1.
Type: String
3.
inUse: The balance in use or reserved for open orders before the event occurred.
1.
Type: String
6.
openOrders: An array containing details of open orders.
1.
clientOrderId: The client-assigned unique identifier for the order.
1.
Type: String
2.
cumulativeQuoteQty: The updated available balance of the asset after the event.
1.
Type: String
3.
executedQty: The quantity of the order that has been executed.
1.
Type: String
4.
orderId: The unique identifier for the order.
1.
Type: String
5.
orderTime: The timestamp when the order was placed.
1.
Type: String (UNIX timestamp in milliseconds & UTC)
6.
origQty: The original quantity specified in the order.
1.
Type: String
7.
price: The price specified in the order.
1.
Type: String
8.
side: The side of the order (BUY or SELL).
1.
Type: String
9.
status: The current status of the order (NEW, PARTIALLY_FILLED, FILLED, CANCELED, REJECTED, EXPIRED).
1.
Type: String
10.
symbol: The trading pair symbol.
1.
Type: String
11.
timeInForce: The time in force for the order (GTC, FOK, IOC).
1.
Type: String
12.
workingTime: The timestamp when the order last processing.
1.
Type: String (UNIX timestamp in milliseconds & UTC)
13.
feeLevel: Indicates the user's fee tier, which in this example is "VIP_5".
1.
Type: String
14.
makerFeeRate: Specifies the fee rate applicable for maker orders in current fee level.
1.
Type: String
15.
takerFeeRate: Specifies the fee rate applicable for taker orders in current fee level.
1.
Type: String

Response Example#

Update Message#

This channel delivers real-time update messages triggered by five key events: order match, place order, cancel order, deposit, and withdraw.
Event Types
1.
ORDER_MATCH: Indicates when an order has been matched with another in the market.
2.
PLACE_ORDER: Triggered when a user places a new order.
3.
CANCEL_ORDER: Indicates the cancellation of an existing order.
4.
DEPOSIT: Occurs when a user initiates a deposit to their account.
5.
WITHDRAW: Indicates a withdrawal request from the user's account.

Place Order & Cancel Order Event#

The meassge of "PLACE_ORDER" and "CANCEL_ORDER" include information about the newly placed or canceled order, its status, and the impact on the user's asset balances.
1.
type: Specifies the type of WebSocket message. For "mybalance" channel, "init" means initialization, and "update" means an update.
1.
Type: String
2.
Value: "update"
2.
channel: Indicates the type of data to subscribe to.
1.
Type: String
2.
Value: "myaccount"
3.
timestamp: Specifies the timestamp of the channel is subscribed.
1.
Type: String (UNIX timestamp in milliseconds & UTC)
2.
Example: "1705642544624"
4.
event: Specifies the type of event that triggered the update message
1.
Type: String
2.
Value: "PLACE_ORDER" or "CANCEL_ORDER"
5.
assets: An array containing information about the user's assets that changed due to the "PLACE_ORDER" or "CANCEL_ORDER" event.
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: String
3.
inUse: The balance in use or reserved for open orders after the event.
1.
Type: String
4.
preAvailable: The available balance of the asset before the event occurred.
1.
Type: String
5.
preInUse: The balance in use or reserved for open orders before the event occurred.
1.
Type: String
6.
orders: An array containing details of the newly placed or canceled order.
1.
clientOrderId: The client-assigned unique identifier for the order.
1.
Type: String
2.
cumulativeQuoteQty: The updated available balance of the asset after the event.
1.
Type: String
3.
executedQty: The quantity of the order that has been executed.
1.
Type: String
4.
orderId: The unique identifier for the order.
1.
Type: String
5.
orderTime: The timestamp when the order was placed.
1.
Type: String (UNIX timestamp in milliseconds & UTC)
6.
origQty: The original quantity specified in the order.
1.
Type: String
7.
price: The price specified in the order.
1.
Type: String
8.
side: The side of the order (BUY or SELL).
1.
Type: String
9.
status: The current status of the order (NEW, PARTIALLY_FILLED, FILLED, CANCELED, REJECTED, EXPIRED).
1.
Type: String
10.
symbol: The trading pair symbol.
1.
Type: String
11.
timeInForce: The time in force for the order (GTC, FOK, IOC).
1.
Type: String
12.
workingTime: The timestamp when the order last processing.
1.
Type: String (UNIX timestamp in milliseconds & UTC)
Place Order Example#
Cancel Order Example#

Order Match Event#

The meassge of "PLACE_ORDER" includes details about the assets affected by the order match, executed orders, and relevant trade information.
1.
type: Specifies the type of WebSocket message. For "mybalance" channel, "init" means initialization, and "update" means an update.
1.
Type: String
2.
Value: "update"
2.
channel: Indicates the type of data to subscribe to.
1.
Type: String
2.
Value: "myaccount"
3.
timestamp: Specifies the timestamp of the channel is subscribed.
1.
Type: String (UNIX timestamp in milliseconds)
2.
Example: "1705642544624"
4.
event: Specifies the type of event that triggered the update message
1.
Type: String
2.
Value: "ORDER_MATCH"
5.
assets: An array containing information about the user's assets that changed due to the order match event.
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: String
3.
inUse: The balance in use or reserved for open orders after the event.
1.
Type: String
4.
preAvailable: The available balance of the asset before the event occurred.
1.
Type: String
5.
preInUse: The balance in use or reserved for open orders before the event occurred.
1.
Type: String
6.
orders: An array containing details of the matched order.
1.
clientOrderId: The client-assigned unique identifier for the order.
1.
Type: String
2.
cumulativeQuoteQty: The updated available balance of the asset after the event.
1.
Type: String
3.
executedQty: The quantity of the order that has been executed.
1.
Type: String
4.
orderId: The unique identifier for the order.
1.
Type: String
5.
orderTime: The timestamp when the order was placed.
1.
Type: String (UNIX timestamp in milliseconds & UTC)
6.
origQty: The original quantity specified in the order.
1.
Type: String
7.
price: The price specified in the order.
1.
Type: String
8.
side: The side of the order (BUY or SELL).
1.
Type: String
9.
status: The current status of the order (NEW, PARTIALLY_FILLED, FILLED, CANCELED, REJECTED, EXPIRED).
1.
Type: String
10.
symbol: The trading pair symbol.
1.
Type: String
11.
timeInForce: The time in force for the order (GTC, FOK, IOC).
1.
Type: String
12.
workingTime: The timestamp when the order last processing.
1.
Type: String (UNIX timestamp in milliseconds & UTC)
7.
trades: An array containing details of the executed trade.
1.
fee: The fee incurred for the trade.
1.
Type: String
2.
feeCurrency: The currency in which the fee is calculated.
1.
Type: String
3.
isBuyerMaker: Indicates whether the buyer is the maker.
1.
Type: Boolean
4.
isMaker: Indicates whether the user is the maker.
1.
Type: Boolean
5.
price: The price at which the trade occurred.
1.
Type: String
6.
qty: The quantity of the base token traded.
1.
Type: String
7.
quoteQty: The quantity of the quote token traded.
1.
Type: String
8.
side: The side of the order (BUY or SELL).
1.
Type: String
9.
symbol: The trading pair symbol.
1.
Type: String
10.
time: The timestamp when the trade occurred.
1.
Type: String (UNIX timestamp in milliseconds & UTC)
Order Match Example#

Deposit & Withdraw Event#

The meassge of "DEPOSIT" and "WITHDRAW" include information about the deposited or withdrawn assets, associated transactions.
1.
type: Specifies the type of WebSocket message. For "mybalance" channel, "init" means initialization, and "update" means an update.
1.
Type: String
2.
Value: "update"
2.
channel: Indicates the type of data to subscribe to.
1.
Type: String
2.
Value: "myaccount"
3.
timestamp: Specifies the timestamp of the channel is subscribed.
1.
Type: String (UNIX timestamp in milliseconds & UTC)
2.
Example: "1705642544624"
4.
event: Specifies the type of event that triggered the update message
1.
Type: String
2.
Value: "DEPOSIT" or "WITHDRAW"
5.
assets: An array containing information about the user's assets that changed due to the "DEPOSIT" or "WITHDRAW" event.
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: String
3.
inUse: The balance in use or reserved for open orders after the event.
1.
Type: String
4.
preAvailable: The available balance of the asset before the event occurred.
1.
Type: String
5.
preInUse: The balance in use or reserved for open orders before the event occurred.
1.
Type: String
6.
deposits: An array containing details of the deposited amount.
1.
address: The address to which the deposit was made.
1.
Type: String
2.
amount: The quantity of the deposited asset.
1.
Type: String
3.
assetName: The name of the deposited asset.
1.
Type: String
4.
id: The unique identifier for the deposit.
1.
Type: String
5.
status: The current status of the deposit (0 for SUCCESS, 1 for PENDING, 2 for FAILED).
1.
Type: String
6.
timestamp: The timestamp when the deposit occurred.
1.
Type: String (UNIX timestamp in milliseconds & UTC)
7.
transactionFee: The transaction fee on our platform associated with the deposit.
1.
Type: String
7.
withdraws: An array containing details of the withdrawn amount.
1.
address: The address to which the withdrawal was made.
1.
Type: String
2.
amount: The quantity of the withdrawn asset.
1.
Type: String
3.
assetName: The name of the withdrawn asset.
1.
Type: String
4.
globalEventId: The global identifier for the withdrawal event on the blockchain. This ID can be used to check the on-chain status of the withdrawal.
1.
Type: String
5.
id: The unique identifier for the deposit.
1.
Type: String
6.
status: The current status of the deposit (0 for SUCCESS, 1 for PENDING, 2 for FAILED).
1.
Type: String
7.
timestamp: The timestamp when the deposit occurred.
1.
Type: String (UNIX timestamp in milliseconds & UTC)
8.
transactionFee: The transaction fee on our platform associated with the deposit.
1.
Type: String
9.
withdrawOrderId: The client-assigned unique identifier for the withdrawal.
1.
Type: String
Deposit Example#
Withdrawal Example#

User Fee Rate Update Event#

The message informs the user that their trading fee rate has changed. User should use the updated fee rate to place their orders or the signature verification will failed.
1.
type: Specifies the type of WebSocket message. For "mybalance" channel, "init" means initialization, and "update" means an update.
1.
Type: String
2.
Value: "update"
2.
channel: Indicates the type of data to subscribe to.
1.
Type: String
2.
Value: "myaccount"
3.
timestamp: Specifies the timestamp of the channel is subscribed.
1.
Type: String (UNIX timestamp in milliseconds & UTC)
2.
Example: "1705642544624"
4.
event: Specifies the type of event that triggered the update message.
1.
Type: String
2.
Value: "UPDATE_USER_FEE_RATE"
5.
feeLevel: Indicates the user's fee tier, which in this example is "VIP_5".
1.
Type: String
2.
Example: "VIP_5"
6.
makerFeeRate: Specifies the fee rate applicable for maker orders in current fee level.
1.
Type: String
2.
Value: "0.000000"
7.
takerFeeRate: Specifies the fee rate applicable for taker orders in current fee level.
1.
Type: String
2.
Value: "0.000200"
User Fee Rate 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
Balance
Built with