@metamask-previews/perps-controller 15.0.0-preview-acb2929f3 → 15.0.0-preview-e3275932a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,42 +12,22 @@ or
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
-
`PerpsController` provides a provider-agnostic API for perpetual trading. It
|
|
16
|
-
normalizes market data, account state, trading, funding, transfers, risk
|
|
17
|
-
calculations, and live subscriptions across enabled providers.
|
|
18
|
-
|
|
19
|
-
Applications construct the controller with a messenger and their
|
|
20
|
-
platform-specific dependencies:
|
|
21
|
-
|
|
22
15
|
```typescript
|
|
23
|
-
import {
|
|
24
|
-
PerpsController,
|
|
25
|
-
type PerpsControllerOptions,
|
|
26
|
-
} from '@metamask/perps-controller';
|
|
27
|
-
|
|
28
|
-
export async function createPerpsController(
|
|
29
|
-
options: PerpsControllerOptions,
|
|
30
|
-
): Promise<PerpsController> {
|
|
31
|
-
const controller = new PerpsController(options);
|
|
32
|
-
await controller.init();
|
|
33
|
-
return controller;
|
|
34
|
-
}
|
|
16
|
+
import { PerpsController } from '@metamask/perps-controller';
|
|
35
17
|
```
|
|
36
18
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
messenger types for client integrations. Provider availability and aggregated
|
|
50
|
-
routing are controlled by client configuration and feature flags.
|
|
19
|
+
Chase orders are client-managed post-only strategies. Use
|
|
20
|
+
`controller.getChaseOrders()` to read retained lifecycle snapshots and
|
|
21
|
+
`controller.suspendChaseOrders()` when the creating client leaves the
|
|
22
|
+
foreground; suspension stops repricing while leaving the latest child order
|
|
23
|
+
resting. Cancel a Chase through `cancelOrder` with its stable strategy handle
|
|
24
|
+
and `orderType: 'chase'`. When using an aggregated provider, also pass the
|
|
25
|
+
`providerId` returned with the Chase snapshot so cancellation routes to its
|
|
26
|
+
owning venue. `chaseMaxDistanceBps` caps adverse movement from the arrival
|
|
27
|
+
price and must be greater than 0 and less than 10,000. The stop follows the
|
|
28
|
+
live touch; the final resting child can sit just inside the boundary after
|
|
29
|
+
venue price-grid rounding, and `distanceChasedBps` reports that actual resting
|
|
30
|
+
distance rounded to the nearest whole basis point.
|
|
51
31
|
|
|
52
32
|
## Contributing
|
|
53
33
|
|
package/package.json
CHANGED