# Create DCA

### Method:

<mark style="color:green;">`Near Call`</mark> `create_dca`

### **Params**

| Name               | Type      | Description                                             |
| ------------------ | --------- | ------------------------------------------------------- |
| `name`             | string    | Name of the DCA                                         |
| `token_in`         | AccountId | Sell Token                                              |
| `token_out`        | AccountId | Buy Token                                               |
| `single_amount_in` | U128      | Number of single executions                             |
| `start_time`       | u64       | millisecond, for example: 1729580505000                 |
| `interval_time`    | u64       | millisecond, for example: 60000(1minute)                |
| `count`            | u16       | dca execution times                                     |
| `lowest_price`     | u64       | lowest execution price, price = token\_in / token\_out  |
| `highest_price`    | u64       | highest execution price, price = token\_in / token\_out |
| `slippage`         | u16       | ref's slippage during swap, min:10, max:10000; 10->0.1% |

### **Near Cli**

```
near call deltadca.testnet create_dca '{"name":"","token_id":"","token_out":"","single_amount_in":"","start_time":123,"interval_time":123,"count":8,"lowest_price":123,"highest":123,"slippage":20}' --deposit=0.02 --accountId=zero.testnet
```

deposit 0.02Nea&#x72;**:** Mainly used for storage, excess will be returned directly

### Event

Name: create\_dca

Event Body:

```json
EVENT_JSON:{"data":[{"dca_vault":{"buy_amount_record":"0","buy_amount_to_user":false,"closed":false,"count":2,"execute_count":0,"highest_price":1000000000,"id":"DCA:224","interval_time":864000000,"left_amount_in":"100000000000000000000000000000","left_amount_out":"0","locked":false,"lowest_price":200000000,"name":"neko quick1","need_withdraw_amount":"0","process":0,"single_amount_in":"50000000000000000000000000000","slippage":50,"start_time":1729526703685,"token_in":"ftv2.nekotoken.near","token_out":"17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1","user":"59583199fc8d2b7207ad71f5213b3e7c917cbf07579d0e63fe1d7cebd9a2cd00"}}],"event":"create_dca","standard":"DeltaBot","version":"0.0.1"}
```

DCA ID will be returned on Event.
