# Margin

## New Margin Order

> Place a new margin order.\
> \
> \*\*Rate Limit:\*\* 100 requests per 2 seconds\
> \
> \*\*Weight:\*\* 5 (IP/UID)

```json
{"openapi":"3.0.0","info":{"title":"Margin Trade API","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v2/margin/order":{"post":{"summary":"New Margin Order","description":"Place a new margin order.\n\n**Rate Limit:** 100 requests per 2 seconds\n\n**Weight:** 5 (IP/UID)","parameters":[{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"recwwindow":{"type":"string"},"price":{"type":"number"},"newClientOrderId":{"type":"string"},"side":{"type":"string"},"volume":{"type":"number"},"symbolName":{"type":"string"}},"required":["type","price","side","volume","symbolName"]}}}},"responses":{"200":{"description":"Order successfully placed","content":{"application/json":{}}}}}}}}
```

## Query Margin Order

> Query existing margin order details.\
> \
> \*\*Rate Limit:\*\* 20 requests per 2 seconds\
> \
> \*\*Weight:\*\* 5 (IP/UID)

```json
{"openapi":"3.0.0","info":{"title":"Margin Trade API","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v2/margin/order":{"get":{"summary":"Query Margin Order","description":"Query existing margin order details.\n\n**Rate Limit:** 20 requests per 2 seconds\n\n**Weight:** 5 (IP/UID)","parameters":[{"name":"orderId","in":"query","schema":{"type":"string"}},{"name":"newClientOrderId","in":"query","schema":{"type":"string"}},{"name":"symbol","in":"query","schema":{"type":"string"}},{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Order query successful","content":{"application/json":{}}}}}}}}
```

## Cancel Margin Order

> Cancel an existing margin order.\
> \
> \*\*Rate Limit:\*\* 100 requests per 2 seconds\
> \
> \*\*Weight:\*\* 5 (IP/UID)

```json
{"openapi":"3.0.0","info":{"title":"Margin Trade API","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v2/margin/cancel":{"post":{"summary":"Cancel Margin Order","description":"Cancel an existing margin order.\n\n**Rate Limit:** 100 requests per 2 seconds\n\n**Weight:** 5 (IP/UID)","parameters":[{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"orderId":{"type":"string"},"symbol":{"type":"string"},"newClientOrderId":{"type":"string"}}}}}},"responses":{"200":{"description":"Order canceled successfully","content":{"application/json":{}}}}}}}}
```

## Current Open Margin Orders

> Retrieve current open margin orders.\
> \
> \*\*Rate Limit:\*\* 20 requests per 2 seconds\
> \
> \*\*Weight:\*\* 1 (IP/UID)

```json
{"openapi":"3.0.0","info":{"title":"Margin Trade API","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v2/margin/openOrders":{"get":{"summary":"Current Open Margin Orders","description":"Retrieve current open margin orders.\n\n**Rate Limit:** 20 requests per 2 seconds\n\n**Weight:** 1 (IP/UID)","parameters":[{"name":"symbol","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"string"}},{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully retrieved open orders","content":{"application/json":{}}}}}}}}
```

## Trade History

> Fetch margin trade history.\
> \
> \*\*Weight:\*\* 1 (IP/UID)

```json
{"openapi":"3.0.0","info":{"title":"Margin Trade API","version":"1.0.0"},"servers":[{"url":"https://openapi.coinlocally.com"}],"paths":{"/sapi/v2/margin/myTrades":{"get":{"summary":"Trade History","description":"Fetch margin trade history.\n\n**Weight:** 1 (IP/UID)","parameters":[{"name":"symbol","in":"query","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"string"}},{"name":"fromId","in":"query","schema":{"type":"string"}},{"name":"X-CH-SIGN","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-CH-TS","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-CH-APIKEY","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully retrieved trade history","content":{"application/json":{}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coinlocally.com/margin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
