Portfolio
The portfolio channel delivers updates to users available balance.
[TOC]
Portfolio JSON Schema
Section titled “Portfolio JSON Schema”{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://bet_stack.com/porfolio_channel_schema", "title": "Portfolio", "type": "object", "description": "Information on a user's portfolio", "properties": { "account_id": { "description": "The ID of the account", "type": "string", "format": "uuid" }, "available_balance": { "description": "The amount of cash the user has available.", "type": "number", "format": "integer" }, "buy_order_liability": { "description": "The liability the user has because of current buy orders.", "type": "number", "format": "integer" }, "sell_order_liability": { "description": "The liability the user has because of current sell orders.", "type": "number", "format": "integer" }, "position_premium_liability": { "description": "Liability from position premiums.", "type": "number", "format": "integer" }, "user_id": { "description": "ID of the user that owns the account for the portfolio.", "type": "number", "format": "integer" } }}Joining
Section titled “Joining”["3","3","portfolio:{{UID}}","phx_join", ""]
Example responses:
Section titled “Example responses:”[ null, null, "portfolio:cW7UI52lToTDbIEYaXAFtqYYaZB2", "summary", { "account_id": "c1c3614c-32ae-4bea-bae4-fc3f52047790", "available_balance": 10000, "buy_order_liability": 20045, "portfolio_value": 22450, "position_liability": 0, "position_premium_liability": 1500, "sell_order_liability": 2800, "total_liability": 3300, "user_id": 1 }]Live updates
Section titled “Live updates”Account Summary changes
Section titled “Account Summary changes”When an account’s summary changes an update is pushed to the channel.
[ null, null, "portfolio:cW7UI52lToTDbIEYaXAFtqYYaZB2", "update", { "account_id": "c1c3614c-32ae-4bea-bae4-fc3f52047790", "available_balance": 10000, "buy_order_liability": 20045, "portfolio_value": 22450, "position_liability": 0, "position_premium_liability": 1500, "sell_order_liability": 2800, "total_liability": 3300, "user_id": 1 }]Payment Status change
Section titled “Payment Status change”When processing payments the server will push current state of the payment when it changes.
[ null, null, "portfolio:cW7UI52lToTDbIEYaXAFtqYYaZB2", "payment_update", { "account_id": "b6e736c0-926f-4150-b613-fe3da9ef2a3f", "amount": 10000, "data": {"handle": "SCtzjJMtI2CrWKSk", "method": "card", "id": "73335df1-37ef-434d-aa4e-7ba1f985ca00", "provider": "paysafe", "provider_id": "25dd5124-11f5-46fa-b49e-48acb6bb53d1", "status": "completed", "type": "deposit" }]
