GithubHelp home page GithubHelp logo

petermax2 / hledger-import Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 204 KB

converts bank export files to hledger transactions

License: MIT License

Rust 100.00%
banking credit-card hledger import rust

hledger-import's Introduction

hledger Import

hledger-import imports data from bank export files (CSV, JSON, etc.) and converts the transactions into a hledger compatible format.

The following bank export formats are supported:

  • Erste Bank JSON exports
  • Revolut CSV exports
  • card complete XML exports
  • flatex CSV exports of settlement accounts
  • flatex PDF invoice

Compile and Run

Compile the project with cargo:

cargo build

or start directly:

cargo run -- --help

Plans for the Future

  • better documentation

hledger-import's People

Contributors

petermax2 avatar

Watchers

 avatar

hledger-import's Issues

Revolut import does not consider fee amount

Given the following CSV input to the Revolut importer

Type;Product;Started Date;Completed Date;Description;Amount;Fee;Currency;State;Balance
CARD_PAYMENT;Current;30.06.24 22:33;01.07.24 07:55;Leanpub;-53,43;0.53;EUR;COMPLETED;140.65

the following transaction is generated

2024-07-01 * Leanpub
  ; valuation: 2024-06-30 22:33:36
  ; revolut_type: CARD_PAYMENT
  Assets:Bank:Revolut                                                 -53,43 EUR
  Equity:Uncategorized

instead of expected transaction:

2024-07-01 * Leanpub
  ; valuation: 2024-06-30 22:33:36
  ; revolut_type: CARD_PAYMENT
  Assets:Bank:Revolut                                                 -53,96 EUR
  Expenses:Banking fees                                                 0,53 EUR
  Equity:Uncategorized

The fee amount is not included in column "Amount" and must therefore be added to the transaction amount. The fee amount should be posted to a separate P/L account.

Make output format of money amounts configurable

The output format of numbers should be configurable. I am thinking about the following parameters:

  • decimal separator
  • thousands seprator
  • precision/number of decimals

Example: have 0 EUR displayed as "0,00 EUR", 1001,1 EUR as "1.001,10 EUR", 1 AAPL as "1 APPL", and so on.

Maybe there is even a way to reuse hledger's config, which would already consider the desired amount formatting.

AmountAndCommodity: -0,01 is rendered without sign

Given the following AmountAndCommodity representing -0,01 EUR

let amount = AmountAndCommodity {
    amount: BigDecimal::from_i64(-1).unwrap() / 100,
    commodity: "EUR".to_owned(),
};

the expected result of amount.to_string() is: "-0,01 EUR" but the actual result is "0,01 EUR". The "-" is lost.

Test case:

#[test]
fn display_minus_one_cent() {
    let amount = AmountAndCommodity {
        amount: BigDecimal::from_i64(-1).unwrap() / 100,
        commodity: "EUR".to_owned(),
    };
    let result = amount.to_string();
    assert_eq!(result, "-0,01 EUR");
}

Split importer into features

Splitting each importer into a separate feature allows users of hledger-import to build the application with only the necessary importers, reducing the overall binary size.

add transaction hash to identify imported transactions without explicit id

Some export files do not provide a unique ID for the exported transactions. This makes checking for duplicates impossible.

In order to fix this issue, a transaction hash should be stored as a tag of the imported transaction.

The "hash" tag should contain the SHA256(date + payee + asset account + asset posting amount) hash of the transaction.

For example, the following transaction

2024-06-01 * Example Store | Test case
    Assets:Import Test     -24,99 EUR
    Expenses:Test

will become

2024-06-01 * Example Store | Test case
    ; hash: 356a4826f536f4b5d4b3597812c4dffb58e2940ad3c54f0e1a9285ad782f732b
    Assets:Import Test     -24,99 EUR
    Expenses:Test

by calculating the SHA256 hash like this:

SHA256("2024-06-01Example StoreAssets:Import Test-24,99 EUR") = 356a4826f536f4b5d4b3597812c4dffb58e2940ad3c54f0e1a9285ad782f732b

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.