# Centralized Auton Exchange (CAX)

## Install Package requied

```
apt install jq -y
curl -SsL https://packages.httpie.io/deb/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/httpie.gpg
sudo echo "deb [arch=amd64 signed-by=/usr/share/keyrings/httpie.gpg] https://packages.httpie.io/deb ./" > /etc/apt/sources.list.d/httpie.list
sudo apt update
apt install snapd
sudo snap install httpie
```

## Config Aut use Wallet.key

<figure><img src="https://2585830168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRzXvi3emVKzTi94K7StD%2Fuploads%2FcxxtyVyLJCRzOGkYqdii%2Fcax-autonity.JPG?alt=media&#x26;token=46ddc20d-e596-4b9a-b8f6-12045ef96495" alt=""><figcaption></figcaption></figure>

## CAX

Get API

```
MESSAGE=$(jq -nc --arg nonce "$(date +%s%N)" '$ARGS.named')
```

Sign-message

```
aut account sign-message $MESSAGE message.sig
```

POST using HTTPie CLI to receive the new API key

```
echo -n $MESSAGE | https https://cax.piccadilly.autonity.org/api/apikeys api-sig:@message.sig
```

<figure><img src="https://2585830168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRzXvi3emVKzTi94K7StD%2Fuploads%2FRHIPn7ioBZMLtEBuzjM4%2Fapi-cax-autonity.JPG?alt=media&#x26;token=6c67c69c-a293-4a9e-86d3-d23d5d8cb8bb" alt=""><figcaption></figcaption></figure>

Save apikey and  set KEY, example: KEY=**RedtwudQyP98Y2zNxxredxxxx123xxxxxxxxxxmxs=**

```
KEY=<apikey>
```

## Check your balance

```
https GET https://cax.piccadilly.autonity.org/api/balances/ API-Key:$KEY
```

## Get the CAX orderbooks

```
https GET https://cax.piccadilly.autonity.org/api/orderbooks/ API-Key:$KEY
```

## Get the current quote price

ATN

```
https GET https://cax.piccadilly.autonity.org/api/orderbooks/ATN-USD/quote API-Key:$KEY
```

NTN

```
https GET https://cax.piccadilly.autonity.org/api/orderbooks/NTN-USD/quote API-Key:$KEY
```

## Buy ATN or NTN

ATN (can change **price** and **amount**)

```
https POST https://cax.piccadilly.autonity.org/api/orders/ API-Key:$KEY pair=ATN-USD side=bid price=1.04  amount=100
```

NTN (can change **price** and **amount**)

```
https POST https://cax.piccadilly.autonity.org/api/orders/ API-Key:$KEY pair=NTN-USD side=bid price=10.04  amount=100
```

## Withdraw from off-chain (Withdraw to chain piccadilly)

ATN (can change **amount**)

```
https POST https://cax.piccadilly.autonity.org/api/withdraws/ API-Key:$KEY symbol=ATN amount=10
```

NTN (can change **amount**)

```
https POST https://cax.piccadilly.autonity.org/api/withdraws/ API-Key:$KEY symbol=NTN amount=10
```

## Deposit to off-chain (send token)

Please "Withdraw from off-chain" before send token.

Can change "--value 1" -> 1-2-3-4 and more&#x20;

Not change 0x7aa3E52908c1a5792acc4d713Eb416A0c77B6db9, because it of NodeSync :))

NTN

```
aut tx make --to 0x7aa3E52908c1a5792acc4d713Eb416A0c77B6db9 --value 1 --ntn | aut tx sign - | aut tx send -
```

ATN

```
aut tx make --to 0x7aa3E52908c1a5792acc4d713Eb416A0c77B6db9 --value 10 | aut tx sign - | aut tx send -
```

##
