• Short guides to forum navigation, searching, posting, translation, alerts and notifications viewable by clicking here.
  • Türk dostlarımıza hoş geldiniz Giriş burada.
  • Scammers are running ads on Facebook and Instagram claiming a giveaway. DO NOT OPEN THESE LINKS AND LOG IN. See this thread: here
  • The Kinesis Community Forum will be down starting on Friday, Eastern Standard Time, and is expected to be back online on Monday. Big changes in the backend are coming!

How to use the Cointracking API alongside historical data loaded from CSV files

Background

Retaining historical data loaded from CSV files is likely to be the start point for most users.

Longer term Cointracking users will have loaded data via the CSV, then manually updated their local currency value of older KAU/KAG records where they precede the available automated pricing (coinmarketcap listing).
These users will not want to start afresh, as it would mean repeating the manual updates of these older records after importing them via the API.

Newer users may start with the CSV method and subsequently move on to the API method.
If their oldest data is after the automated pricing, then it would be an option for them to start afresh, but it's possible that they've made other manual changes to the data in CT eg classifying some Withdrawals as Spend or Deposits as Income.

So, I think it's reasonable to assume that there will be many that will want to use their CSV imports as the base and then progress to using the API.

Preventing the loading of duplicate records

The API method generates a unique Trade ID that prevents a subsequent API load for the same date range from loading the same Kinesis transaction and therefore creating a duplicate.

This works well. However, the same format of Trade ID's will not have been created in Cointracking by the historical loading of CSV files, so duplicates between API and CSV methods will not be prevented based on Trade ID's .

Here is the Kinesis help article showing how to link to the Cointracking API.

When creating the API job, you have the option to set a start date for the API to import data from.
Ensure that you fill this in to avoid creating duplicates of your historical data from the CSV files.

It's important to note that the format of the date is dd.mm.yyyy hh:mm:ss
If you enter eg 21/01/2024, it will appear to be accepted, but won't actually be displayed in the start date field and will have no effect on setting the start point for the API import, so you'll end up with lots of duplicates.
You need to use . between the day, month and year.


1720020375363.png
 
Last edited:
What can I do if I didn't set a start date and already have lots of duplicates

If this has happened, the duplicates should all have occurred on the first API import.


Pause the API import
Before going any further, go to https://cointracking.info/import/kinesis_api and edit your API job.
Switch Check your trades to manually rather than automatically.
This will prevent the duplicates being recreated while you are cleaning them up.
You can switch this back once you're done.


Identify the Add date for the first API import
If you identify one of the records from that API import, all the rest in the same API load should have the same Add date.

Here is an example from my testing:
1720021338375.png
The second of each pair (Imported From: job_kinesis) came from the initial API load.


Delete the records from the first API import
You can use the Bulk Delete feature to delete all records with that Add date (ie all of the ones in that first API load).
However, it's not immediately obvious from the screen how to apply the Add date on the Bulk Delete screen.

1720021536744.png

However, if you click on either
  • delete all transactions
  • delete only KINESIS transactions
the options are then displayed.

1720021606442.png
I checked the Add date for the most recent and oldest transaction loaded via the API.
They both had the same date down to the second.
The selection criteria above allows dates to the second to be input, even though I only went to the minute resolution.


Set the start date for the API import
Now identify the date/time of the last record that you imported from CSV and set the API start date as described in post #1.
If desired, switch Check your trades to automatically rather than manually.
 
Last edited:

Translate

Back
Top