MCPcopy Index your code
hub / github.com/ccxt/ccxt / Position

Method Position

java/lib/src/main/java/io/github/ccxt/types/Position.java:35–66  ·  view source on GitHub ↗
(Object raw)

Source from the content-addressed store, hash-verified

33 public Map<String, Object> info;
34
35 @SuppressWarnings("unchecked")
36 public Position(Object raw) {
37 Map<String, Object> data = TypeHelper.toMap(raw);
38 this.symbol = TypeHelper.safeString(data, "symbol");
39 this.id = TypeHelper.safeString(data, "id");
40 this.timestamp = TypeHelper.safeInteger(data, "timestamp");
41 this.datetime = TypeHelper.safeString(data, "datetime");
42 this.contracts = TypeHelper.safeFloat(data, "contracts");
43 this.contractSize = TypeHelper.safeFloat(data, "contractSize");
44 this.side = TypeHelper.safeString(data, "side");
45 this.notional = TypeHelper.safeFloat(data, "notional");
46 this.leverage = TypeHelper.safeFloat(data, "leverage");
47 this.unrealizedPnl = TypeHelper.safeFloat(data, "unrealizedPnl");
48 this.realizedPnl = TypeHelper.safeFloat(data, "realizedPnl");
49 this.collateral = TypeHelper.safeFloat(data, "collateral");
50 this.entryPrice = TypeHelper.safeFloat(data, "entryPrice");
51 this.markPrice = TypeHelper.safeFloat(data, "markPrice");
52 this.liquidationPrice = TypeHelper.safeFloat(data, "liquidationPrice");
53 this.marginMode = TypeHelper.safeString(data, "marginMode");
54 this.hedged = TypeHelper.safeBool(data, "hedged");
55 this.maintenanceMargin = TypeHelper.safeFloat(data, "maintenanceMargin");
56 this.maintenanceMarginPercentage = TypeHelper.safeFloat(data, "maintenanceMarginPercentage");
57 this.initialMargin = TypeHelper.safeFloat(data, "initialMargin");
58 this.initialMarginPercentage = TypeHelper.safeFloat(data, "initialMarginPercentage");
59 this.marginRatio = TypeHelper.safeFloat(data, "marginRatio");
60 this.lastUpdateTimestamp = TypeHelper.safeInteger(data, "lastUpdateTimestamp");
61 this.lastPrice = TypeHelper.safeFloat(data, "lastPrice");
62 this.stopLossPrice = TypeHelper.safeFloat(data, "stopLossPrice");
63 this.takeProfitPrice = TypeHelper.safeFloat(data, "takeProfitPrice");
64 this.percentage = TypeHelper.safeFloat(data, "percentage");
65 this.info = TypeHelper.getInfo(data);
66 }
67}

Callers

nothing calls this directly

Calls 6

toMapMethod · 0.95
safeStringMethod · 0.95
safeIntegerMethod · 0.95
safeFloatMethod · 0.95
safeBoolMethod · 0.95
getInfoMethod · 0.95

Tested by

no test coverage detected