Click or drag to resize

How to bulk import instruments from a txt file

ArthaChitra has a import feature which facilitates user to import instrument definitions from a txt/csv file. This is helpful in case you want to append a large number of scrips at one go.

Given the open architecture of ArthaChitra, if you have a txt/csv file which contains the name etc of the scrip/symbols then you can custom code your own instrument definition import type. You can use the same to parse and import the contents of the txt/csv file using the 'Import Instrument Definition' feature.

ArthaChitra by default comes some pre-defined scripts which lets you import Instrument Definitions. We will further discuss them below:

How to import a txt/zip file

Please follow the below steps to import a Instrument.txt file into ArthaChitra

  • Download the txt or zip file. If the instrument file is in zip format then extract the txt file.
  • In ArthaChitra Main View menu bar, goto Settings > Instruments > Import
  • In the 'Import Instrument Definition View' select the 'Default Instrument Definition Import Type' or your any of the import type from the drop-down and click on the Import button
  • In the file selector dialog select the txt/csv file you want to import
  • Restart ArthaChitra when prompted

Delete existing Instrument Definitions

Before any bulk import you can delete the existing instrument definitions by following the below steps.

  • In Main View menu bar got Settings > Options > Data tab
  • Click on the "Delete Instrument Definitions" button
  • Restart ArthaChitra

Note: The above will delete all instrument definitions and is a irrecoverable process. It is advisable you take necessary backups.

Delete Instrument Def
Default Instrument Definition Import Type

The Default Instrument Definition import type lets you import instrument definition exported by ArthaChitra.

The default instrument definitions are appended in *.txt file separated by ';' (semi-colon - without the ') with the following values:

The header format for the txt file will be:

@Name;@Description;@InstrumentType;@Exchange;@Currency;@TickSize;@SessionTemplate;@Rollover;@PointValue;@DefaultQuantity;@QuantityDivisor};@Adapter Symbols;@Dividends;@Splits

The below table further clarifies the fields.

Field

Type

Description

Name

String

Max length 255

Description

String

Max length 255

Instrument Type

Int32

InstrumentType

Exchange

Int32

Exchange

Currency

Int32

Currency

Tick size

Double

Tick size of the instrument

Session Template

String

Session Template

Rollover

String

String value (applicable for Futures scripts only)

Point value

Double

Point value of the instrument

Default quantity

Int32

Default quantity

Quantity divisor

Int32

Quantity divisor - this is reserved from fractional shares

Connection symbols

String

Connection symbol separated by ',' (comma - without the ')

Dividends

DateTime-Double

Date-Amount (separated by ',' (comma - without the ')

Splits

DateTime-Double

Date-Factor (separated by ',' (comma without the ')

Note: Entries beginning with '#' (without the ') are treated as comments and will be ignored

Instrument List format

An Instrument List is a text file separated by ';' (semi-colon without the ') having 3 (three) fields namely

  • @InstrumentList: Each line must start with '@InstrumentList' indicating its an instrument list.
  • Name of the list: Custom name of the instrument list.
  • Instrument name: Name of instrument(s) separated by ',' (comma without the ').

An example will be:

@InstrumentList;Cash;^NIFTY NSE,BERGEPAINT NSE,ONGC NSE,RELIANCE NSE,TVSMOTOR NSE,BANKNIFTY 05 2022 NSE

Note: The Instrument names must conform the naming conventions as mentioned here

NSE Stock Instrument Definition Import Type

The NSE Stock Instrument Definition Import Type lets one to import the scrips as found in the NSE Bhavcopy

  • In Main View menu bar goto Settings > Import > Instrument Definition
  • In the Instrument Definition Import dialog select 'NSE Stock Instrument Definition'
  • Download the 'CM-UDiFF Common Bhavcopy Final.zip' from NSE (link given in the dialog)
  • Extract the bhavcopy (csv file) from the downloaded zip file
  • In the Instrument Definition Import dialog click on the Ok button
  • In the Open file dialog, select the bhavcopy csv file
  • Restart ArthaChitra when prompted.