# Historical Data Download

### Prerequisites

* Standard Configuration Package is installed
* Proxy server deployed
* Vault is configured
* Credentials to Proxy Server is saved to the Vault

## Restarting the workflow service

1. Go to the `Data -> Workflows` section
2. Click the "Refresh Storage" button

[![](https://docs.finmars.com/uploads/images/gallery/2024-07/scaled-1680-/image-1721342820362.png)](https://docs.finmars.com/uploads/images/gallery/2024-07/image-1721342820362.png)

## Configuring download and import parameters
1. Download the Input JSON files for setting up the automatic download of historical data
2. Edit the following fields in the first two objects under `workers`  section in the`exante_historical_step_1.json`:<br><br> 
  `"name": "Download Positions"`
   * `date_from` - account opening date (there may be a limit of one year with Exante).
   * `date_to` - enter yesterday's date
   * `portfolios` - add account identifiers for download
   * `secret` -  add the name of the secret containing credentials in the vault
   <br><br>
  `"name": "Download Transactions"`
   * `date_from` -  account opening date (there may be a limit of one year with Exante).
   * `date_to` - enter yesterday's date
   * `portfolios` - add account identifiers for download
   * `secret` -  add the name of the secret containing credentials in the vault
```json
{
    "user_code": "workflow-manager",
    "configuration_code": "com.finmars.standard-workflow",
    "name":"Exante Historical - Step 1 (Download): positions, transactions",
    "workers": [
        {
            "order": 1,
            "configuration_code": "com.finmars.standard-workflow",
            "name": "Download Positions",
            "user_code": "download-exante-positions",
            "state_type": "period",
            "download_options":{
                "date_from": "2024-01-01", # <---------------- edit this
                "date_to": "2024-07-14", # <---------------- edit this
                "type":"day",
                "periodicity":"monthly",
                "portfolios": ["IKF1218.001"], # <---------------- edit this
                "secret":"itech-demo" # <---------------- edit this
            },
            "data_options": {
                "global_status": null,
                "source": null,
                "type": null,
                "portfolios": null
            },
            "import_options": {
                "scheme": null,
                "import_type": null,
                "pricing_policy": null
            },
            "calculation_options": {
                "date_from": null,
                "date_to": null,
                "portfolios": null
            },
            "state_options": {
                "input_path": null
            }
        },
        {
            "order": 2,
            "configuration_code": "com.finmars.standard-workflow",
            "name": "Download Transactions",
            "user_code": "download-exante-transactions",
            "state_type": "period",
            "download_options":{
                "date_from": "2024-01-01", # <---------------- edit this
                "date_to": "2024-07-14", # <---------------- edit this
                "type": "period",
                "periodicity":"monthly",
                "portfolios": ["IKF1218.001"], # <---------------- edit this
                "secret":"itech-demo" # <---------------- edit this
            },
            "data_options": {
                "global_status": null,
                "source": null,
                "type": null,
                "portfolios": null
            },
            "import_options": {
                "scheme": null,
                "import_type": null,
                "pricing_policy": null
            },
            "calculation_options": {
                "date_from": null,
                "date_to": null,
                "portfolios": null
            },
            "state_options": {
                "input_path": null
            }
        },
        {
            "order": 3,
            "configuration_code": "com.finmars.standard-workflow",
            "name": "Generate State",
            "user_code": "generate-state",
            "state_type": "fixed",
            "download_options":{
                "date_from": null,
                "date_to": null,
                "type": null,
                "periodicity":null,
                "portfolios": null,
                "secret":null
            },
            "data_options": {
                "global_status": null,
                "source": null,
                "type": null,
                "portfolios": null
            },
            "import_options": {
                "scheme": null,
                "import_type": null,
                "pricing_policy": null
            },
            "calculation_options": {
                "date_from": null,
                "date_to": null,
                "portfolios": null
            },
            "state_options": {
                "input_path": "/input-workflows/exante/exante_historical_step_2.json"
            }
        }
    ]
}
```
4. Edit the `secret` in `exante_historical_step_6.json` similarly to the previous step:
```json
{
    "user_code": "workflow-manager",
    "configuration_code": "com.finmars.standard-workflow",
    "name":"Exante Historical - Step 6 (Download): market data",
    "schedule": null,
    "workers": [
        {
            "order": 1,
            "configuration_code": "com.finmars.standard-workflow",
            "name": "Download Prices (Exante)",
            "user_code": "download-exante-prices",
            "state_type": "period",
            "download_options": {
                "date_from": "first_transaction_date",
                "date_to": "now",
                "type": "period",
                "periodicity": "monthly",
                "portfolios": ["All"],
                "secret": "itech-demo" # <------------ edit this
            },
            "data_options": {
                "global_status": null,
                "source": null,
                "type": null,
                "portfolios": null
            },
            "import_options": {
                "scheme": null,
                "import_type": null,
                "pricing_policy": null
            },
            "calculation_options": {
                "date_from": null,
                "date_to": null,
                "portfolios": null
            },
            "state_options": {
                "input_path": null
            }
        },
        {
            "order": 2,
            "configuration_code": "com.finmars.standard-workflow",
            "name": "Download Fx Rates (Unified DB)",
            "user_code": "download-finmarsdb-fx-rates",
            "state_type": "period",
            "download_options": {
                "date_from": "first_transaction_date",
                "date_to": "now",
                "type": "period",
                "periodicity": "monthly",
                "portfolios": ["All"],
                "secret": null
            },
            "data_options": {
                "global_status": null,
                "source": null,
                "type": null,
                "portfolios": null
            },
            "import_options": {
                "scheme": null,
                "import_type": null,
                "pricing_policy": null
            },
            "calculation_options": {
                "date_from": null,
                "date_to": null,
                "portfolios": null
            },
            "state_options": {
                "input_path": null
            }
        },
        {
            "order": 3,
            "configuration_code": "com.finmars.standard-workflow",
            "name": "Generate State",
            "user_code": "generate-state",
            "state_type": "fixed",
            "download_options": {
                "date_from": null,
                "date_to": null,
                "type": null,
                "periodicity": null,
                "portfolios": null,
                "secret": null
            },
            "data_options": {
                "global_status": null,
                "source": null,
                "type": null,
                "portfolios": null
            },
            "import_options": {
                "scheme": null,
                "import_type": null,
                "pricing_policy": null
            },
            "calculation_options": {
                "date_from": null,
                "date_to": null,
                "portfolios": null
            },
            "state_options": {
                "input_path": "/input-workflows/exante/exante_historical_step_7.json"
            }
        }
    ]
}

```

## Running the historical data download
1. Go to the `Dashboard` section
2. Check which layout is selected. It should be  `Workflow`. If another layout is selected, change it to the required one.
[![](https://docs.finmars.com/uploads/images/gallery/2024-07/scaled-1680-/image-1721344250763.png)](https://docs.finmars.com/uploads/images/gallery/2024-07/image-1721344250763.png)
3. Select the `Inputs` section
4. Expand the details for `Exante Historical - Step 1 (Download): positions, transactions
5. Click the `Start Worfklow` button
[![](https://docs.finmars.com/uploads/images/gallery/2024-07/scaled-1680-/image-1721344450671.png)](https://docs.finmars.com/uploads/images/gallery/2024-07/image-1721344450671.png)