forked from EvergreenCrypto/docker-finance
docker-finance | modern accounting for the power-user
Dedicated to Michael Morgan: a beautiful, beautiful soul.
---
Internal signing keys:
Aaron Fiore (sole author)
- 518A22F85BEFD32BCC99C48603F90C4F35E0213E
- 31ECA5C347A0CC0815EDE730A3EACCFCDA7E685E
- C8187C585CB07A4DA81CC0F37318B50EBE9C0DA8
Internal repositories (rebased from):
Staging:
$ git log -n1 --pretty=format:"%H"
c8e0cd66f6c89fa7b3c62f72fb524a4cc454b7b6
$ git rev-list --max-parents=0 HEAD
ac3863b8c234755855f1aea3a07a853122decdf2
Private:
$ git log -n1 --pretty=format:"%H"
69bb3591eaa2990a9637832bb484690e00c4f926
$ git rev-list --max-parents=0 HEAD
a5c1cc9fb593c4cf09bc0adfef6cb6d2964511ae
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
fields code_,date,description,type,amount_,direction,subaccount
|
||||
|
||||
date-format %m/%d/%y
|
||||
|
||||
account1 liabilities:gemini:%subaccount:USD
|
||||
# Flip sign for liabilities accounting
|
||||
amount -%amount_ USD
|
||||
|
||||
comment type:%type, direction:%direction
|
||||
|
||||
if %direction ^IN$
|
||||
account2 equity:gemini:%subaccount:withdrawal:USD
|
||||
|
||||
if %direction ^OUT$
|
||||
account2 expenses:gemini:%subaccount:USD
|
||||
|
||||
if %direction ^OUT$
|
||||
& %type ^interest$
|
||||
account2 expenses:gemini:%subaccount:interest:USD
|
||||
|
||||
# vim: sw=2 sts=2 si ai et
|
||||
@@ -0,0 +1,123 @@
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
fields code_,date,type,order_type,currency_one,currency_two,amount_,cost,fees,destination,txid,direction,subaccount
|
||||
|
||||
date-format %Y-%m-%d %H:%M:%S
|
||||
description %date +0000
|
||||
|
||||
account1 assets:gemini:%subaccount:%currency_one
|
||||
amount %amount_ %currency_one
|
||||
|
||||
comment type:%type, order_type:%order_type, eid:%code_, destination:%destination, txid:%txid, direction:%direction
|
||||
|
||||
################################################################################
|
||||
# #
|
||||
# TRANSFER #
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
if %direction ^OUT$
|
||||
amount -%amount_ %currency_one
|
||||
|
||||
if %direction ^IN$
|
||||
account2 equity:gemini:%subaccount:withdrawal:%currency_one
|
||||
|
||||
if %direction ^OUT$
|
||||
account2 equity:gemini:%subaccount:deposit:%currency_one
|
||||
|
||||
if %direction ^OUT$
|
||||
& %fees [1-9]
|
||||
amount3 -%fees %currency_two
|
||||
account3 assets:gemini:%subaccount:%currency_one
|
||||
amount4 %fees %currency_two
|
||||
account4 expenses:gemini:%subaccount:fees:withdrawals:%currency_two
|
||||
comment type:%type, order_type:%order_type, eid:%code_, destination:%destination, txid:%txid, direction:%direction, taxed_as:SPEND
|
||||
comment3 %date +0000,SPEND,gemini,%currency_two,%fees,USD,,FEE
|
||||
# Marked as comment3 in case user-defined rules use comment2 to SPEND the non-fee amount
|
||||
|
||||
if %direction ^OUT$
|
||||
& %fees [1-9]
|
||||
& %currency_two ^GUSD$
|
||||
comment3 %date +0000,SPEND,gemini,%currency_two,%fees,USD,%fees,FEE
|
||||
|
||||
if %direction ^OUT$
|
||||
& %destination (^ACH$|^Wire$|^SEN$)
|
||||
account2 equity:gemini:%subaccount:deposit:USD
|
||||
comment type:%type, order_type:%order_type, eid:%code_, destination:%destination, direction:%direction
|
||||
|
||||
# NOTE: "Reward" is treated as a opening trade position since it's a rebate (not income)
|
||||
if %direction ^IN$
|
||||
& %order_type ^Reward$
|
||||
account2 income:gemini:%subaccount:rewards:%currency_one
|
||||
comment type:%type, order_type:%order_type, eid:%code_, direction:%direction, taxed_as:REBATE
|
||||
comment2 %date +0000,BUY,gemini,%currency_one,%amount_,USD,,,
|
||||
|
||||
################################################################################
|
||||
# #
|
||||
# INCOME #
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
# Gemini Earn
|
||||
if %direction ^IN$
|
||||
& %type ^INTEREST$
|
||||
account2 income:gemini:%subaccount:earn:%currency_one
|
||||
comment type:%type, order_type:%order_type, tid:%code_, direction:%direction, taxed_as:INCOME
|
||||
comment2 %date +0000,INCOME,gemini,%currency_one,%amount_,USD,%cost,%type
|
||||
|
||||
################################################################################
|
||||
# #
|
||||
# TRADE #
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
if %type ^TRADE$
|
||||
account2 assets:gemini:%subaccount:%currency_two
|
||||
|
||||
if %order_type ^Buy$
|
||||
amount %amount_ %currency_one @@ %cost %currency_two
|
||||
comment type:%type, order_type:%order_type, order_id:%txid, tid:%code_, taxed_as:BUY
|
||||
comment2 %date +0000,BUY,gemini,%currency_one,%amount_,%currency_two,%cost,%currency_two,%fees
|
||||
|
||||
if %order_type ^Sell$
|
||||
amount -%amount_ %currency_one @@ %cost %currency_two
|
||||
comment type:%type, order_type:%order_type, order_id:%txid, tid:%code_, taxed_as:SELL
|
||||
comment2 %date +0000,SELL,gemini,%currency_one,%amount_,%currency_two,%cost,%currency_two,%fees
|
||||
|
||||
# GUSD/USD workaround (see preprocess)
|
||||
if %type ^TRADE$
|
||||
& %currency_one ^GUSD$
|
||||
& %currency_two ^USD$
|
||||
amount %amount_ %currency_one @@ %amount_ %currency_two
|
||||
comment2 %date +0000,BUY,gemini,%currency_one,%amount_,%currency_two,%amount_,,
|
||||
|
||||
if %type ^TRADE$
|
||||
& %order_type ^Sell$
|
||||
& %currency_one ^GUSD$
|
||||
& %currency_two ^USD$
|
||||
amount -%amount_ %currency_one @@ %amount_ %currency_two
|
||||
comment2 %date +0000,SELL,gemini,%currency_one,%amount_,%currency_two,%amount_,,
|
||||
|
||||
if %type ^TRADE$
|
||||
& %fees [1-9]
|
||||
account3 assets:gemini:%subaccount:%currency_two
|
||||
amount3 -%fees %currency_two
|
||||
account4 expenses:gemini:%subaccount:fees:trades:%currency_two
|
||||
amount4 %fees %currency_two
|
||||
|
||||
# vim: sw=2 sts=2 si ai et
|
||||
365
container/src/hledger-flow/accounts/gemini/gemini-shared.bash
Executable file
365
container/src/hledger-flow/accounts/gemini/gemini-shared.bash
Executable file
@@ -0,0 +1,365 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#
|
||||
# "Libraries"
|
||||
#
|
||||
|
||||
[ -z "$DOCKER_FINANCE_CONTAINER_REPO" ] && exit 1
|
||||
source "${DOCKER_FINANCE_CONTAINER_REPO}/src/hledger-flow/lib/lib_preprocess.bash" "$1" "$2"
|
||||
|
||||
#
|
||||
# Implementation
|
||||
#
|
||||
|
||||
[ -z "$global_year" ] && exit 1
|
||||
[ -z "$global_subaccount" ] && exit 1
|
||||
|
||||
[ -z "$global_in_path" ] && exit 1
|
||||
[ -z "$global_out_path" ] && exit 1
|
||||
|
||||
[ -z "$global_in_filename" ] && exit 1
|
||||
|
||||
#
|
||||
# Unified format between all file types:
|
||||
#
|
||||
# UID,Date,Type,OrderType,CurrencyOne,CurrencyTwo,Amount,Price,Fees,Destination,TXID,Direction,Subaccount
|
||||
#
|
||||
|
||||
function parse_transfers()
|
||||
{
|
||||
# NOTE: header can be variable, ineffective to assert_header
|
||||
# TODO: optimize: do successive test_headers and whichever wins, use that string so `xsv select` is avoided
|
||||
local _header=""
|
||||
|
||||
if lib_preprocess::test_header "info_feeCurrency"; then
|
||||
|
||||
_header="info_eid,info_timestampms,info_type,info_currency,info_feeCurrency,info_amount,info_feeAmount,info_destination,info_txHash"
|
||||
# Off-chain withdrawal
|
||||
lib_preprocess::test_header "info_method" && _header+=",info_method"
|
||||
|
||||
# NOTE: this hack in a sort because docker-finance's fetch (or their server's) pagination. See fetch implementation.
|
||||
xsv select "$_header" "$global_in_path" \
|
||||
| gawk -v global_year="$global_year" -v global_subaccount="$global_subaccount" -M -v PREC=100 \
|
||||
'{
|
||||
if (NR<2)
|
||||
next
|
||||
|
||||
cmd = "date --utc \"+%F %T\" --date=@$(expr $(echo "$2"/1000 | bc))" | getline date
|
||||
|
||||
if (date !~ global_year)
|
||||
next
|
||||
|
||||
# NOTE: If info_method isnt ACH/Wire/SEN then it should be GUSD (exception being CreditCard)
|
||||
if ($10 == "ACH" || $10 == "Wire" || $10 == "SEN") {$4="USD"}
|
||||
else {gsub(/,USD,/,",GUSD,")}
|
||||
|
||||
# Get/set info_method (if available)
|
||||
if ($10 == "ACH" || $10 == "Wire" || $10 == "SEN" || $10 == "CreditCard") {$8=$10}
|
||||
|
||||
printf $1 OFS # UID (info_eid)
|
||||
printf date OFS # Date
|
||||
printf "TRANSFER" OFS # Type
|
||||
printf $3 OFS # OrderType (info_type)
|
||||
printf $4 OFS # CurrencyOne (info_currency)
|
||||
printf $5 OFS # CurrencyTwo (info_feeCurrency)
|
||||
|
||||
# Amount
|
||||
# TODO: getline an gawk remove-zeros script
|
||||
# NOTE: .18 requires PREC passed to gawk
|
||||
info_amount=sprintf("%.18f", $6)
|
||||
if (info_amount ~ /^[0-9]*\.[0-9]+/)
|
||||
{
|
||||
sub(/0+$/, "", info_amount)
|
||||
sub(/\.$/, "", info_amount)
|
||||
sub(/^\./, "0.", info_amount)
|
||||
}
|
||||
printf info_amount OFS
|
||||
|
||||
printf OFS # Price (N/A)
|
||||
|
||||
# Fees
|
||||
info_feeAmount=sprintf("%.18f", $7)
|
||||
if (info_feeAmount ~ /^[0-9]*\.[0-9]+/)
|
||||
{
|
||||
sub(/0+$/, "", info_feeAmount)
|
||||
sub(/\.$/, "", info_feeAmount)
|
||||
sub(/^\./, "0.", info_feeAmount)
|
||||
}
|
||||
printf info_feeAmount OFS
|
||||
|
||||
printf $8 OFS # Destination (info_destination)
|
||||
printf $9 OFS # TXID (info_txHash)
|
||||
|
||||
direction=($3 ~ /^Withdrawal$/ ? "OUT" : "IN")
|
||||
printf direction OFS
|
||||
|
||||
printf global_subaccount
|
||||
|
||||
printf "\n"
|
||||
|
||||
}' FS=, OFS=, >"$global_out_path"
|
||||
else
|
||||
# A base string that will work with transfers that are only deposits but not yet withdrawals
|
||||
_header="info_eid,info_timestampms,info_type,info_currency,info_amount"
|
||||
|
||||
lib_preprocess::test_header "info_destination" && _header+=",info_destination"
|
||||
lib_preprocess::test_header "info_txHash" && _header+=",info_txHash"
|
||||
|
||||
# Off-chain withdrawal
|
||||
lib_preprocess::test_header "info_method" && _header+=",info_method"
|
||||
|
||||
xsv select "$_header" "$global_in_path" \
|
||||
| gawk -v global_year="$global_year" -v global_subaccount="$global_subaccount" -M -v PREC=100 \
|
||||
'{
|
||||
if (NR<2)
|
||||
next
|
||||
|
||||
cmd = "date --utc \"+%F %T\" --date=@$(expr $(echo "$2"/1000 | bc))" | getline date
|
||||
|
||||
if (date !~ global_year)
|
||||
next
|
||||
|
||||
# NOTE: If info_method isnt ACH/Wire/SEN then it should be GUSD (exception being CreditCard)
|
||||
if ($8 == "ACH" || $8 == "Wire" || $8 == "SEN") {$4="USD"}
|
||||
else {gsub(/,USD,/,",GUSD,")}
|
||||
|
||||
# Get/set info_method (if available)
|
||||
if ($8 == "ACH" || $8 == "Wire" || $8 == "SEN" || $8 == "CreditCard") {$6=$8}
|
||||
|
||||
printf $1 OFS # UID (info_eid)
|
||||
printf date OFS # Date
|
||||
printf "TRANSFER" OFS # Type
|
||||
printf $3 OFS # OrderType (info_type)
|
||||
printf $4 OFS # CurrencyOne (info_currency)
|
||||
printf OFS # CurrencyTwo (N/A)
|
||||
|
||||
# Amount
|
||||
direction=($5 ~ /^-/ ? "OUT" : "IN")
|
||||
sub(/^-/, "", $5)
|
||||
# TODO: getline an gawk remove-zeros script
|
||||
# NOTE: .18 will need PREC passed to gawk
|
||||
info_amount=sprintf("%.18f", $5)
|
||||
if (info_amount ~ /^[0-9]*\.[0-9]+/)
|
||||
{
|
||||
sub(/0+$/, "", info_amount)
|
||||
sub(/\.$/, "", info_amount)
|
||||
sub(/^\./, "0.", info_amount)
|
||||
}
|
||||
printf info_amount OFS
|
||||
|
||||
printf OFS # Price (N/A)
|
||||
printf OFS # Fees (N/A)
|
||||
printf $6 OFS # Destination (info_destination)
|
||||
printf $7 OFS # TXID (info_txHash)
|
||||
|
||||
printf direction OFS
|
||||
printf global_subaccount
|
||||
|
||||
printf "\n"
|
||||
|
||||
}' FS=, OFS=, >"$global_out_path"
|
||||
fi
|
||||
}
|
||||
|
||||
function parse_trades()
|
||||
{
|
||||
# TODO: Gemini bug? In rare cases, Gemini may include client_order_id ("echo back")
|
||||
# even though docker-finance never supplies an identifier nor place any orders.
|
||||
# In all cases, this column will be ignored but must also allow the header assertion to pass.
|
||||
local _client_order_id=""
|
||||
lib_preprocess::test_header "client_order_id" && _client_order_id=",client_order_id"
|
||||
|
||||
lib_preprocess::assert_header "price,amount,timestamp,timestampms,type,aggressor,fee_currency,fee_amount,tid,order_id,exchange,is_auction_fill,is_clearing_fill,symbol${_client_order_id}"
|
||||
|
||||
# Get symbol from base pair trade. Example: bchbtc-Trades.csv will return bch
|
||||
local _account_currency
|
||||
_account_currency="$(echo $global_in_filename | cut -d"-" -f1 | sed 's:...$::')"
|
||||
|
||||
gawk -v account_currency="$_account_currency" \
|
||||
-v global_year="$global_year" -v global_subaccount="$global_subaccount" \
|
||||
'{
|
||||
if (NR<2)
|
||||
next
|
||||
|
||||
cmd = "date --utc \"+%F %T\" --date=@$(expr $(echo "$4"/1000 | bc))" | getline date
|
||||
|
||||
if (date !~ global_year)
|
||||
next
|
||||
|
||||
gsub(/,1INCH,/,",ONEINCH,")
|
||||
|
||||
printf $9 OFS # UID (tid)
|
||||
printf date OFS # Date
|
||||
printf "TRADE" OFS # Type
|
||||
printf $5 OFS # OrderType (type)
|
||||
printf toupper(account_currency) OFS # CurrencyOne (account_currency)
|
||||
printf $7 OFS # CurrencyTwo (fee_currency)
|
||||
|
||||
# TODO: getline an gawk remove-zeros script
|
||||
amount=sprintf("%.8f", $2)
|
||||
if (amount ~ /^[0-9]*\.[0-9]+/)
|
||||
{
|
||||
sub(/0+$/, "", amount)
|
||||
sub(/\.$/, "", amount)
|
||||
sub(/^\./, "0.", amount)
|
||||
}
|
||||
printf amount OFS # Amount
|
||||
|
||||
cost=sprintf("%.8f", $1*$2)
|
||||
if (cost ~ /^[0-9]*\.[0-9]+/)
|
||||
{
|
||||
sub(/0+$/, "", cost)
|
||||
sub(/\.$/, "", cost)
|
||||
sub(/^\./, "0.", cost)
|
||||
}
|
||||
printf cost OFS # Price (will be used as a "total" for @@, not price)
|
||||
|
||||
fee_amount=sprintf("%.8f", $8)
|
||||
if (fee_amount ~ /^[0-9]*\.[0-9]+/)
|
||||
{
|
||||
sub(/0+$/, "", fee_amount)
|
||||
sub(/\.$/, "", fee_amount)
|
||||
sub(/^\./, "0.", fee_amount)
|
||||
}
|
||||
printf fee_amount OFS # Fees
|
||||
|
||||
printf OFS # Destination (N/A)
|
||||
printf $10 OFS # TXID (tid)
|
||||
|
||||
# Direction
|
||||
printf OFS
|
||||
|
||||
printf global_subaccount
|
||||
|
||||
printf "\n"
|
||||
|
||||
}' FS=, OFS=, "$global_in_path" >"$global_out_path"
|
||||
}
|
||||
|
||||
function parse_earn()
|
||||
{
|
||||
lib_preprocess::assert_header "earnTransactionId,transactionId,transactionType,amountCurrency,amount,priceCurrency,priceAmount,dateTime"
|
||||
|
||||
gawk -v global_year="$global_year" -v global_subaccount="$global_subaccount" -M -v PREC=100 \
|
||||
'{
|
||||
if (NR<2)
|
||||
next
|
||||
|
||||
cmd = "date --utc \"+%F %T\" --date=@$(expr $(echo "$8"/1000 | bc))" | getline date
|
||||
|
||||
if (date !~ global_year)
|
||||
next
|
||||
|
||||
gsub(/,1INCH,/,",ONEINCH,")
|
||||
|
||||
printf $1 OFS # UID (earnTransactionId)
|
||||
printf date OFS # Date
|
||||
printf "INTEREST" OFS # Type
|
||||
printf "EARN" OFS # OrderType (type)
|
||||
printf $4 OFS # CurrencyOne (amountCurrency)
|
||||
printf OFS # CurrencyTwo
|
||||
|
||||
# Amount
|
||||
# TODO: getline an gawk remove-zeros script
|
||||
# NOTE: .22 requires PREC passed to gawk
|
||||
amount=sprintf("%.22f", $5)
|
||||
if (amount ~ /^[0-9]*\.[0-9]+/)
|
||||
{
|
||||
sub(/0+$/, "", amount)
|
||||
sub(/\.$/, "", amount)
|
||||
sub(/^\./, "0.", amount)
|
||||
}
|
||||
printf amount OFS
|
||||
|
||||
# Price
|
||||
priceAmount=sprintf("%.22f", $7*$5)
|
||||
if (priceAmount ~ /^[0-9]*\.[0-9]+/)
|
||||
{
|
||||
sub(/0+$/, "", priceAmount)
|
||||
sub(/\.$/, "", priceAmount)
|
||||
sub(/^\./, "0.", priceAmount)
|
||||
}
|
||||
printf priceAmount OFS
|
||||
|
||||
printf OFS # Fees
|
||||
printf OFS # Destination
|
||||
printf OFS # TXID
|
||||
|
||||
# Direction
|
||||
printf "IN" OFS
|
||||
|
||||
printf global_subaccount
|
||||
|
||||
printf "\n";
|
||||
|
||||
}' FS=, OFS=, "$global_in_path" >"$global_out_path"
|
||||
}
|
||||
|
||||
function parse_card()
|
||||
{
|
||||
lib_preprocess::assert_header "Reference Number,Transaction Post Date,Description of Transaction,Transaction Type,Amount"
|
||||
|
||||
gawk -v global_year="$global_year" -v global_subaccount="$global_subaccount" \
|
||||
'{
|
||||
if (NR<2)
|
||||
next
|
||||
|
||||
# Date format is MM/DD/YY
|
||||
yy=substr($2, 7, 2)
|
||||
global_yy=substr(global_year, 3, 2)
|
||||
|
||||
if (yy != global_yy)
|
||||
next
|
||||
|
||||
printf $1 OFS # Reference Number
|
||||
printf $2 OFS # Transaction Post Date
|
||||
printf $3 OFS # Description of Transaction
|
||||
printf $4 OFS # Transaction Type
|
||||
printf $5 OFS # Amount
|
||||
|
||||
direction=($5 ~ /^-/ ? "IN" : "OUT")
|
||||
printf direction OFS
|
||||
|
||||
printf global_subaccount
|
||||
|
||||
printf "\n";
|
||||
|
||||
}' FS=, OFS=, "$global_in_path" >"$global_out_path"
|
||||
}
|
||||
|
||||
function main()
|
||||
{
|
||||
# Transfers
|
||||
lib_preprocess::test_header "info_eid" && parse_transfers && return 0
|
||||
|
||||
# Trades (may come in either form)
|
||||
lib_preprocess::test_header "tid" && parse_trades && return 0
|
||||
lib_preprocess::test_header "info_tid" && parse_trades && return 0
|
||||
|
||||
# Earn
|
||||
lib_preprocess::test_header "earnTransactionId" && parse_earn && return 0
|
||||
|
||||
# Card
|
||||
lib_preprocess::test_header "Reference Number" && parse_card && return 0
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
# vim: sw=2 sts=2 si ai et
|
||||
@@ -0,0 +1,20 @@
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
include ../../../../../src/accounts/gemini/gemini-card-shared.rules
|
||||
|
||||
# vim: sw=2 sts=2 si ai et
|
||||
@@ -0,0 +1,20 @@
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
include ../../../../../src/accounts/gemini/gemini-exchange-shared.rules
|
||||
|
||||
# vim: sw=2 sts=2 si ai et
|
||||
23
container/src/hledger-flow/accounts/gemini/template/gemini-shared.bash
Executable file
23
container/src/hledger-flow/accounts/gemini/template/gemini-shared.bash
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
[ -z "$DOCKER_FINANCE_CONTAINER_REPO" ] && exit 1
|
||||
source "${DOCKER_FINANCE_CONTAINER_REPO}/src/hledger-flow/accounts/gemini/gemini-shared.bash"
|
||||
|
||||
# vim: sw=2 sts=2 si ai et
|
||||
@@ -0,0 +1,13 @@
|
||||
Reference Number,Transaction Post Date,Description of Transaction,Transaction Type,Amount
|
||||
0000000012,05/01/24,,interest,115.05
|
||||
0000000011,04/06/24,Formerly Chuck's WA United States,clearing,116.90
|
||||
0000000010,04/05/24,,payment_transaction,-1150.50
|
||||
0000000009,04/04/24,Sneed's Feed and Seed WA United States,clearing,1169.69
|
||||
0000000008,04/01/23,,interest,15.05
|
||||
0000000007,03/04/23,Formerly Chuck's WA United States,clearing,16.90
|
||||
0000000006,03/03/23,,payment_transaction,-150.50
|
||||
0000000005,03/03/23,Sneed's Feed and Seed WA United States,clearing,169.69
|
||||
0000000004,03/01/22,,interest,5.05
|
||||
0000000003,02/04/22,Formerly Chuck's WA United States,clearing,6.90
|
||||
0000000002,02/03/22,,payment_transaction,-50.50
|
||||
0000000001,02/02/22,Sneed's Feed and Seed WA United States,clearing,69.69
|
||||
|
@@ -0,0 +1,13 @@
|
||||
Reference Number,Transaction Post Date,Description of Transaction,Transaction Type,Amount
|
||||
0000000012,05/01/24,,interest,115.05
|
||||
0000000011,04/06/24,Formerly Chuck's WA United States,clearing,116.90
|
||||
0000000010,04/05/24,,payment_transaction,-1150.50
|
||||
0000000009,04/04/24,Sneed's Feed and Seed WA United States,clearing,1169.69
|
||||
0000000008,04/01/23,,interest,15.05
|
||||
0000000007,03/04/23,Formerly Chuck's WA United States,clearing,16.90
|
||||
0000000006,03/03/23,,payment_transaction,-150.50
|
||||
0000000005,03/03/23,Sneed's Feed and Seed WA United States,clearing,169.69
|
||||
0000000004,03/01/22,,interest,5.05
|
||||
0000000003,02/04/22,Formerly Chuck's WA United States,clearing,6.90
|
||||
0000000002,02/03/22,,payment_transaction,-50.50
|
||||
0000000001,02/02/22,Sneed's Feed and Seed WA United States,clearing,69.69
|
||||
|
@@ -0,0 +1,13 @@
|
||||
Reference Number,Transaction Post Date,Description of Transaction,Transaction Type,Amount
|
||||
0000000012,05/01/24,,interest,115.05
|
||||
0000000011,04/06/24,Formerly Chuck's WA United States,clearing,116.90
|
||||
0000000010,04/05/24,,payment_transaction,-1150.50
|
||||
0000000009,04/04/24,Sneed's Feed and Seed WA United States,clearing,1169.69
|
||||
0000000008,04/01/23,,interest,15.05
|
||||
0000000007,03/04/23,Formerly Chuck's WA United States,clearing,16.90
|
||||
0000000006,03/03/23,,payment_transaction,-150.50
|
||||
0000000005,03/03/23,Sneed's Feed and Seed WA United States,clearing,169.69
|
||||
0000000004,03/01/22,,interest,5.05
|
||||
0000000003,02/04/22,Formerly Chuck's WA United States,clearing,6.90
|
||||
0000000002,02/03/22,,payment_transaction,-50.50
|
||||
0000000001,02/02/22,Sneed's Feed and Seed WA United States,clearing,69.69
|
||||
|
@@ -0,0 +1,20 @@
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
include ../../gemini-card-shared.rules
|
||||
|
||||
# vim: sw=2 sts=2 si ai et
|
||||
@@ -0,0 +1 @@
|
||||
../../gemini-shared.bash
|
||||
@@ -0,0 +1,3 @@
|
||||
earnTransactionId,transactionId,transactionType,amountCurrency,amount,priceCurrency,priceAmount,dateTime
|
||||
XXXXXXX1,XXXXXXX1,Interest,BTC,0.00001012346,USD,47300.543210987654321,1641157200000
|
||||
XXXXXXX0,XXXXXXX0,Interest,BTC,0.00001012345,USD,46725.123456789012345,1641070800000
|
||||
|
@@ -0,0 +1,5 @@
|
||||
info_type,info_status,info_timestampms,info_eid,info_currency,info_amount,info_feeAmount,info_feeCurrency,info_txHash,info_outputIdx,info_destination,info_withdrawalId,id,txid,timestamp,datetime,network,address,addressTo,addressFrom,tag,tagTo,tagFrom,type,amount,currency,status,updated,fee_cost,fee_currency,fee,info_method
|
||||
Deposit,Complete,1643767322000,100000000000,USD,5000.00,,,,,,,100000000000,,1643767322000,2022-02-02T02:02:02.000Z,,,,,,,,deposit,5000.00,USD,ok,,,,,ACH
|
||||
Reward,Complete,1643767322000,100000000001,BTC,0.00012345,,,,,,,100000000001,,1643767322000,2022-02-02T02:02:02.000Z,,,,,,,,reward,0.00012345,BTC,ok,,,,,CreditCard
|
||||
Reward,Complete,1643940244000,100000000002,BTC,0.00001234,,,,,,,100000000002,,1643940244000,2022-02-04T02:04:04.000Z,,,,,,,,reward,1.234E-5,BTC,ok,,,,,CreditCard
|
||||
Withdrawal,Complete,1657850522000,100000000003,BTC,0.01,0,BTC,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,1,bc1qXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,100000000003,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0,1657850522000,2022-07-15T02:02:02.000Z,,bc1qXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,,,,,,withdrawal,0.01,BTC,ok,,0,BTC,,
|
||||
|
@@ -0,0 +1,7 @@
|
||||
price,amount,timestamp,timestampms,type,aggressor,fee_currency,fee_amount,tid,order_id,exchange,is_auction_fill,is_clearing_fill,symbol
|
||||
25100.00,0.02223456,1686798203,1686798203456,Sell,,USD,1.47000,200000000005,222222222222,gemini,,,BTCUSD
|
||||
25100.00,0.02234567,1686798193,1686798193123,Sell,,USD,1.47800,200000000004,222222222222,gemini,,,BTCUSD
|
||||
25100.00,0.02345678,1686798183,1686798183000,Sell,,USD,1.47890,200000000003,222222222222,gemini,,,BTCUSD
|
||||
22222.00,0.05210987,1655258544,1655258544456,Buy,,USD,3.01200,100000000002,111111111111,gemini,,,BTCUSD
|
||||
22222.00,0.05321098,1655258533,1655258533123,Buy,,USD,3.01230,100000000001,111111111111,gemini,,,BTCUSD
|
||||
22222.00,0.05432109,1655258522,1655258522000,Buy,,USD,3.01234,100000000000,111111111111,gemini,,,BTCUSD
|
||||
|
@@ -0,0 +1,3 @@
|
||||
earnTransactionId,transactionId,transactionType,amountCurrency,amount,priceCurrency,priceAmount,dateTime
|
||||
XXXXXXX1,XXXXXXX1,Interest,BTC,0.00001012346,USD,47300.543210987654321,1641157200000
|
||||
XXXXXXX0,XXXXXXX0,Interest,BTC,0.00001012345,USD,46725.123456789012345,1641070800000
|
||||
|
@@ -0,0 +1,5 @@
|
||||
info_type,info_status,info_timestampms,info_eid,info_currency,info_amount,info_feeAmount,info_feeCurrency,info_txHash,info_outputIdx,info_destination,info_withdrawalId,id,txid,timestamp,datetime,network,address,addressTo,addressFrom,tag,tagTo,tagFrom,type,amount,currency,status,updated,fee_cost,fee_currency,fee,info_method
|
||||
Deposit,Complete,1643767322000,100000000000,USD,5000.00,,,,,,,100000000000,,1643767322000,2022-02-02T02:02:02.000Z,,,,,,,,deposit,5000.00,USD,ok,,,,,ACH
|
||||
Reward,Complete,1643767322000,100000000001,BTC,0.00012345,,,,,,,100000000001,,1643767322000,2022-02-02T02:02:02.000Z,,,,,,,,reward,0.00012345,BTC,ok,,,,,CreditCard
|
||||
Reward,Complete,1643940244000,100000000002,BTC,0.00001234,,,,,,,100000000002,,1643940244000,2022-02-04T02:04:04.000Z,,,,,,,,reward,1.234E-5,BTC,ok,,,,,CreditCard
|
||||
Withdrawal,Complete,1657850522000,100000000003,BTC,0.01,0,BTC,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,1,bc1qXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,100000000003,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0,1657850522000,2022-07-15T02:02:02.000Z,,bc1qXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,,,,,,withdrawal,0.01,BTC,ok,,0,BTC,,
|
||||
|
@@ -0,0 +1,7 @@
|
||||
price,amount,timestamp,timestampms,type,aggressor,fee_currency,fee_amount,tid,order_id,exchange,is_auction_fill,is_clearing_fill,symbol
|
||||
25100.00,0.02223456,1686798203,1686798203456,Sell,,USD,1.47000,200000000005,222222222222,gemini,,,BTCUSD
|
||||
25100.00,0.02234567,1686798193,1686798193123,Sell,,USD,1.47800,200000000004,222222222222,gemini,,,BTCUSD
|
||||
25100.00,0.02345678,1686798183,1686798183000,Sell,,USD,1.47890,200000000003,222222222222,gemini,,,BTCUSD
|
||||
22222.00,0.05210987,1655258544,1655258544456,Buy,,USD,3.01200,100000000002,111111111111,gemini,,,BTCUSD
|
||||
22222.00,0.05321098,1655258533,1655258533123,Buy,,USD,3.01230,100000000001,111111111111,gemini,,,BTCUSD
|
||||
22222.00,0.05432109,1655258522,1655258522000,Buy,,USD,3.01234,100000000000,111111111111,gemini,,,BTCUSD
|
||||
|
@@ -0,0 +1,3 @@
|
||||
earnTransactionId,transactionId,transactionType,amountCurrency,amount,priceCurrency,priceAmount,dateTime
|
||||
XXXXXXX1,XXXXXXX1,Interest,BTC,0.00001012346,USD,47300.543210987654321,1641157200000
|
||||
XXXXXXX0,XXXXXXX0,Interest,BTC,0.00001012345,USD,46725.123456789012345,1641070800000
|
||||
|
@@ -0,0 +1,5 @@
|
||||
info_type,info_status,info_timestampms,info_eid,info_currency,info_amount,info_feeAmount,info_feeCurrency,info_txHash,info_outputIdx,info_destination,info_withdrawalId,id,txid,timestamp,datetime,network,address,addressTo,addressFrom,tag,tagTo,tagFrom,type,amount,currency,status,updated,fee_cost,fee_currency,fee,info_method
|
||||
Deposit,Complete,1643767322000,100000000000,USD,5000.00,,,,,,,100000000000,,1643767322000,2022-02-02T02:02:02.000Z,,,,,,,,deposit,5000.00,USD,ok,,,,,ACH
|
||||
Reward,Complete,1643767322000,100000000001,BTC,0.00012345,,,,,,,100000000001,,1643767322000,2022-02-02T02:02:02.000Z,,,,,,,,reward,0.00012345,BTC,ok,,,,,CreditCard
|
||||
Reward,Complete,1643940244000,100000000002,BTC,0.00001234,,,,,,,100000000002,,1643940244000,2022-02-04T02:04:04.000Z,,,,,,,,reward,1.234E-5,BTC,ok,,,,,CreditCard
|
||||
Withdrawal,Complete,1657850522000,100000000003,BTC,0.01,0,BTC,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,1,bc1qXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,100000000003,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0,1657850522000,2022-07-15T02:02:02.000Z,,bc1qXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,,,,,,withdrawal,0.01,BTC,ok,,0,BTC,,
|
||||
|
@@ -0,0 +1,7 @@
|
||||
price,amount,timestamp,timestampms,type,aggressor,fee_currency,fee_amount,tid,order_id,exchange,is_auction_fill,is_clearing_fill,symbol
|
||||
25100.00,0.02223456,1686798203,1686798203456,Sell,,USD,1.47000,200000000005,222222222222,gemini,,,BTCUSD
|
||||
25100.00,0.02234567,1686798193,1686798193123,Sell,,USD,1.47800,200000000004,222222222222,gemini,,,BTCUSD
|
||||
25100.00,0.02345678,1686798183,1686798183000,Sell,,USD,1.47890,200000000003,222222222222,gemini,,,BTCUSD
|
||||
22222.00,0.05210987,1655258544,1655258544456,Buy,,USD,3.01200,100000000002,111111111111,gemini,,,BTCUSD
|
||||
22222.00,0.05321098,1655258533,1655258533123,Buy,,USD,3.01230,100000000001,111111111111,gemini,,,BTCUSD
|
||||
22222.00,0.05432109,1655258522,1655258522000,Buy,,USD,3.01234,100000000000,111111111111,gemini,,,BTCUSD
|
||||
|
@@ -0,0 +1,20 @@
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
include ../../gemini-exchange-shared.rules
|
||||
|
||||
# vim: sw=2 sts=2 si ai et
|
||||
@@ -0,0 +1 @@
|
||||
../../gemini-shared.bash
|
||||
Reference in New Issue
Block a user