# Long/Short Symmetry

* Long and short are naturally supported by swapping either `token0` to `token1`, or `token1` to `token0`. It’s worth noting that the margin payment can be the token we swap from or swap to.
  * For example, when we long ETH using USDC, we swap the margin and borrowed USDC into ETH. In this case, USDC is the token we swap *from* in this case.
  * On the other hand, if we short ETH using USDC, it’s swapping the borrowed ETH to USDC (long USDC). In this case, we put down USDC as the margin payment. USDC is the token we swap *to* in this case.
* At position opening, the `marginFrom`, `marginTo`, `liquidity` and swap calldata `data` can cover all 4 cases:
  * long `token0` using `token1`: `marginFrom` is `token1`, `data` instructs swapping `token1` to `token0`
  * long `token1` using `token0`: `marginFrom` is `token0`, `data` instructs swapping `token0` to `token1`
  * short `token0` using `token1` :`marginTo` is `token1`, `data` instructs swapping `token0` to `token1`
  * short `token1` using `token0` :`marginTo` is `token0`, `data` instructs swapping `token1` to `token0`
* At position closing, the `repayFrom` and `repayTo` are the amounts to pay back to LP position such that at least the borrowed liquidity is repaid to LP position. The `amountSwap` how much of position and premium amount we swap back.
  * In the case of long ETH with USDC, the `amountSwap` swaps all ETH back to USDC, only leaving enough ETH to repay to LP.
  * In the case of short ETH with USDC, the `amountSwap` only swaps just enough USDC into ETH to repay, with the rest USDC as gains to trader.


---

# 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://erc20-docs.particle.trade/developer/long-short-symmetry.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.
