Import historical trades from Quicken reports (QuickenFile)

Modified on 2017/02/23 07:18 by Eugene — Categorized as: Community Components

Syntax


public QuickenFile(WealthScript aws, string aTradeFileName, string aDateTimeFormat, string abarsSymbol)
public bool ReadQuickenFile()
public bool DisplayQuickenTradeData()
public bool ChartQuickenTradeData()

Parameter Description

Constructor:

wsAn instance of WealthScript object passed by reference
aTradeFileNamePath to Quicken report data file
aDateTimeFormatDateTime format string
abarsSymbolBars symbol

Description

Courtesy higgsja. Author's original description follows:

Setting up Quicken

  1. Researched Quicken data access options. There are some commercial drivers available. Chose to simply use the built in reporting capability and export to file.
  2. Using "Investing|Security List" menu item, edit all securities "Security" field to be the stock symbol. There are no Quicken reports that will provide the actual Symbol field in the output.
  3. Create a report
    • start with "Investments|Investment Transactions".
    • customize date range as necessary; important that all trades be in the date range so using "earliest" is wise.
    • customize Accounts tab for the accounts you want.
    • customize Actions tab to include:
      • Bought, BoughtX
      • Sold, SoldX
      • ShtSell, ShtSellX
      • CvrShrt, CvrShrtX
      • ReinvDiv, ReinvLG, ReinvSh, ReinvInt, ReinvMd
      • Added, Removed: cause message in debug; see Limitations
    • export to Excel compatible format, creating a text file

Features

  1. Uses a standard report extract from Quicken.
  2. Keeps transactions by accounts aligned.
  3. Handles actual share size for either buy or sell transactions. Creates additional transactions to split or aggregate as necessary.
  4. Uses Wealth-Lab features to enable daily, weekly, etc. charting while still posting the actual transactions.
  5. Provides 3 Functions:
    • ReadQuickenFile(): reads the file
    • DisplayQuickenTradeData(): puts the trades to the debug window
    • ChartQuickenTradeData(): puts the trades on the chart

Limitations

  1. No Quicken report will give lots so this works as first in first out (FIFO).
  2. No check of ticker symbol validity is done. This means you may have data in the file that does not appear on the chart as there is a symbol mismatch.
  3. Where lots are split, the commission is not split.
  4. The list, QuickenTradeData, is not accessible directly.
  5. "Added" and "Removed" transactions are treated as "Bought" and "Sold" respectively. Since the report does not have the original date of a purchase but does include the initial price, the price may be changed to the Close on the day of the transaction. An error can result as the price may be outside the High/Low range on the given day. An asterisk will be displayed next to prices that have been changed when using the DisplayQuickenTradeData() method.

Changes

  1. Enabled "Added" and "Removed" transactions without errors.
  2. Added BoughtX, SoldX, ShtSellX, CvrShrtX to the code.

Example


using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Components; /*** Requires installation of Community.Components Extension from www.wealth-lab.com > Extensions ***/

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { ClearDebug(); bool ret;

//Change this to an actual path containig Quicken reports QuickenFile qf = new QuickenFile(this, @"c:\users\joe\my documents\investments\quickenwl.txt",@"m/d/yyyy", Bars.Symbol); ret = qf.ReadQuickenFile(); ret = qf.DisplayQuickenTradeData(); ret = qf.ChartQuickenTradeData(); } } }