-
Notifications
You must be signed in to change notification settings - Fork 521
Expand file tree
/
Copy pathcomponents.yaml
More file actions
86 lines (82 loc) · 3.16 KB
/
components.yaml
File metadata and controls
86 lines (82 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
components:
schemas:
# -------------------------------------------------------------------------
# Primitive Types & Formats
# -------------------------------------------------------------------------
FloatString:
type: string
# Regex: Allow optional negative sign, integers, decimals.
# Excludes scientific notation for safety, but allows "0.5", "-10.00".
pattern: "^-?\\d+(\\.\\d+)?$"
description: "Decimal number serialized as a string to preserve precision (avoiding IEEE 754 floating point errors)."
example: "1250.50"
Address:
type: string
# Standard EVM address pattern (0x followed by 40 hex chars).
pattern: "^0x[a-fA-F0-9]{40}$"
description: "Ethereum Virtual Machine (EVM) compatible wallet or contract address."
example: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
# -------------------------------------------------------------------------
# Domain Objects
# -------------------------------------------------------------------------
AssetPosition:
type: object
description: "Represents a user's current holding or leverage position in an asset."
required:
- assetAddress
- size
- unrealizedPnl
properties:
assetAddress:
$ref: "#/components/schemas/Address"
symbol:
type: string
description: "Human-readable ticker symbol (e.g., 'WETH')."
example: "WETH"
size:
$ref: "#/components/schemas/FloatString"
description: "The size of the position in asset units."
entryPrice:
$ref: "#/components/schemas/FloatString"
unrealizedPnl:
$ref: "#/components/schemas/FloatString"
description: "Current unrealized profit or loss."
MarginSummary:
type: object
description: "Summary of the account's margin health and leverage details."
required:
- totalEquity
- usedMargin
- freeMargin
properties:
totalEquity:
$ref: "#/components/schemas/FloatString"
description: "Total account value (Balance + Unrealized PnL)."
usedMargin:
$ref: "#/components/schemas/FloatString"
description: "Margin currently locked in open positions."
freeMargin:
$ref: "#/components/schemas/FloatString"
description: "Available margin for opening new positions."
marginLevelPercentage:
type: number
format: float
description: "Health ratio usually calculated as (Equity / Used Margin) * 100."
example: 150.5
L2Level:
type: object
description: "A single level in the Order Book (Level 2 Data)."
required:
- price
- size
properties:
price:
$ref: "#/components/schemas/FloatString"
description: "The price point for this order level."
size:
$ref: "#/components/schemas/FloatString"
description: "Total volume/liquidity available at this price."
orderCount:
type: integer
description: "Number of individual orders at this price level (optional)."
example: 5