Skip to content

Instantly share code, notes, and snippets.

@t-nissie
Last active December 2, 2025 22:16
Show Gist options
  • Select an option

  • Save t-nissie/22a4a9525d423208c7f784ce507d0bc5 to your computer and use it in GitHub Desktop.

Select an option

Save t-nissie/22a4a9525d423208c7f784ce507d0bc5 to your computer and use it in GitHub Desktop.
メルカリの暗号資産(ビットコイン、イーサリアム、XRP)の月間取引報告書CSVファイルから確定申告のために年中購入または年中売却の数量と金額を計算するRubyスクリプト(とそれをCrystalで書き直したもの)

mercari.rb and mercari.cr

メルカリの暗号資産(ビットコインBTC、イーサリアムETH、XRP)の月間取引報告書CSVファイルから 確定申告のために年間の損益計算をするためのRubyスクリプトmercari.rbと それをCrystal言語に移植したmercari.cr

ライセンスは GPLv3 で、完全無保証です。税務署に怒られてもしりません。

参考文献: https://help.jp.mercari.com/guide/articles/1513/ メルカル ビットコイン取引 取引報告書・損益計算方法

Author: Takeshi Nishimatsu

mercari.rb

目的 (Purpose): メルカリで暗号資産取引をしている人の確定申告 (Japanese tax return)

使い方 (Usage): LANG=ja_JP.UTF-8 ruby mercari.rb report_2024?.csv report_20241?.csv

計算書: 実行すると標準出力される年中購入または年中売却の数量と金額を国税庁の総平均法用002.xlsx計算書にコピペ

表計算: CSVファイルも同時に出力されるのでエクセルなどで開くと表の最下行でも年中の数量と金額がわかる

出力CSVファイル: btc_buy.csv, btc_sel.csv, eth_buy.csv, eth_sel.csv, xrp_buy.csv, xrp_sel.csv

実行例:

 $ LANG=ja_JP.UTF-8 ruby mercari.rb report_2024?.csv report_20241?.csv
 btc_buy.csv has   7 transactions.  Total: 0.000411220  JPY:    4237
 btc_sel.csv has   5 transactions.  Total: 0.000323540  JPY:    4680
 eth_buy.csv has   2 transactions.  Total: 0.005641040  JPY:    2132
 eth_sel.csv has   2 transactions.  Total: 0.000695680  JPY:     500
 xrp_buy.csv has   0 transactions.  Total: 0.000000000  JPY:       0
 xrp_sel.csv has   0 transactions.  Total: 0.000000000  JPY:       0

mercari.cr

使い方 (Usage): crystal build mercari.cr && ./mercari report_2024?.csv report_20241?.csv

比較 (Compare): diff -ub mercari.rb mercari.cr

計算書: 実行すると標準出力される年中購入または年中売却の数量と金額を国税庁の総平均法用002.xlsx計算書にコピペ

表計算: CSVファイルも同時に出力されるのでエクセルなどで開くと表の最下行でも年中の数量と金額がわかる

出力CSVファイル: btc_buy.csv, btc_sel.csv, eth_buy.csv, eth_sel.csv, xrp_buy.csv, xrp_sel.csv

実行例:

 $ crystal build mercari.cr && ./mercari report_2024?.csv report_20241?.csv
 btc_buy.csv has   7 transactions.  Total: 0.000411220  JPY:    4237
 btc_sel.csv has   5 transactions.  Total: 0.000323540  JPY:    4680
 eth_buy.csv has   2 transactions.  Total: 0.005641040  JPY:    2132
 eth_sel.csv has   2 transactions.  Total: 0.000695680  JPY:     500
 xrp_buy.csv has   0 transactions.  Total: 0.000000000  JPY:       0
 xrp_sel.csv has   0 transactions.  Total: 0.000000000  JPY:       0

Rubyスクリプトmercari.rbをCrystal言語に移植したときの感想

感想を忘れないうちに箇条書き。

  • Crystal 1.17.1 (2025-07-22) を使った。
  • macOSならbrew install crystalだけで使えるようになった。
  • CrystalはOCamlなみに型にうるさいRuby。
  • crystal build mercari.crとコンパイルするとmercariができる。
  • GrokとかAIにRubyスクリプトをコピーアンドペーストしてCrystalに書き直すよう指示すると、まあまあよいかんじに直してくれる。
  • AIが関数やメソッドの引数の型まで推定してくれる。
  • Fortranのクセで if (a==b) then と書きがちだが、Rubyではthenを省略できる。Crystalだとthenはエラー。
  • RubyでもCrystalでも if a==b とカッコはいらない。
  • andorはCrystalではエラーになるので&&||を使っておく。
  • "".to_fはRubyなら0.0、Crystalだどエラー。
  • RubyのARGF.each{|line| }は改行までlineに格納される。
  • Crystalには今のところARGFがない。
  • CrystalではARGV.each do |filename|; File.each_line(filename) do |line|とする。
  • CrystalではArray, Hashなどに複数種類の型を格納できない。
  • 空のHashはRubyなら{}だけでよいが、CrystalだとHash(String,OutputCSV).newなどと書かなくてはいけない。
  • Rubyのopen(@filename, "w")はCrystalではFile.open(@filename, "w")に直す。
  • Ruby版mercari.rbとCrystal版mercariとの速度を (for i in {1..100000}; do cat report_20243.csv; done) > report_20243_100k.csv などとして作った大きなファイルを入力にして比較したがほとんど変わらなかった。 1行づつ読み込んで1行づつ書き出しているからか?
  • 参考になりそうな文章

ToDo

Use CSV library instead of split(','). But, note that:

2025年の月間取引報告書CSVファイルでテスト

[bex]*.csv
mercari
mercari.dwarf
virtual_currency_faq_03.pdf
*~
# -*-Crystal-*-
# 目的 (Purpose): marcari.rbをCrystalで書き直してみる
# 使い方 (Usage): crystal build mercari.cr && ./mercari report_2024?.csv report_20241?.csv
# 比較 (Compare): diff -ub mercari.rb mercari.cr
# 計算書: 実行すると標準出力される年中購入または年中売却の数量と金額を国税庁の総平均法用002.xlsx計算書にコピペ
# 表計算: CSVファイルも同時に出力されるのでエクセルなどで開くと表の最下行でも年中の数量と金額がわかる
# 出力CSVファイル: btc_buy.csv, btc_sel.csv, eth_buy.csv, eth_sel.csv, xrp_buy.csv, xrp_sel.csv
# 実行例:
# $ crystal build mercari.cr && ./mercari report_2024?.csv report_20241?.csv
# btc_buy.csv has 7 transactions. Total: 0.000411220 JPY: 4237
# btc_sel.csv has 5 transactions. Total: 0.000323540 JPY: 4680
# eth_buy.csv has 2 transactions. Total: 0.005641040 JPY: 2132
# eth_sel.csv has 2 transactions. Total: 0.000695680 JPY: 500
# xrp_buy.csv has 0 transactions. Total: 0.000000000 JPY: 0
# xrp_sel.csv has 0 transactions. Total: 0.000000000 JPY: 0
# Author: Takeshi Nishimatsu
# Licence: GPLv3
# 完全無保証: 税務署に怒られてもしりません
# 参考:
# https://help.jp.mercari.com/guide/articles/1513/ メルカル ビットコイン取引 取引報告書・損益計算方法
##
class OutputCSV
def initialize(coin : String, bs : String)
@buy_or_sell = bs
@filename = coin+"_"+bs+".csv"
@file = File.open(@filename, "w")
@file << "取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考\n"
@counter = 1 # Line number counter for the output CSV file
@total = 0.0 # 数量
@jpy = 0 # 金額
end
def transaction(line, add : String, yen : String)
add = "0.0" if add=="" # プロモーションで受け取った暗号通貨はまるまる収入になる。そのときsellファイルの減少数量は""。
@file << line << "\n"
@counter += 1
@total += add.to_f
@jpy += yen.to_i
end
def close() # Before closing, add a SUM line in the end of the file.
printf("%s has %3i transactions. Total: %.9f JPY: %7i\n", @filename, @counter-1, @total, @jpy)
if @buy_or_sell=="buy"
@file << ",,,,,=SUM(F2:F#{@counter}),,,=SUM(I2:I#{@counter}),,,,,,,,,\n"
elsif @buy_or_sell=="sel"
@file << ",,,,,,,=SUM(H2:H#{@counter}),=SUM(I2:I#{@counter}),,,,,,,,,\n"
end
@file.close
end
end
# コインの種類×2個のCSV出力ファイルを*2次元*hashとして用意
files = {"btc"=>Hash(String,OutputCSV).new, "eth"=>Hash(String,OutputCSV).new, "xrp"=>Hash(String,OutputCSV).new}
files.each{|coin,h|
["buy", "sel"].each{|bs| h[bs]=OutputCSV.new(coin,bs)}
}
# コマンドライン引数で与えられた月間取引報告書CSVファイルを読み込み
ARGV.each do |filename|
File.each_line(filename) do |line|
row = line.split(',')
if row[0] =~ /^20[2-9][0-9]/
files.each{|coin,h|
cu = coin.upcase
if row[1]=="購入" && (row[3]=="#{cu}/JPY" || row[3]=="#{cu}/POINT")
h["buy"].transaction(line, row[5], row[8])
elsif row[1]=="受取" && row[3]==cu
h["buy"].transaction(line, row[5], row[8])
h["sel"].transaction(line, row[7], row[8])
elsif row[1]=="売却" && row[3]=="#{cu}/JPY"
h["sel"].transaction(line, row[7], row[8])
end
}
end
end
end
# 年中購入または年中売却の数量と金額を書き出して出力CSVファイルをclose
files.each{|coin,h|
h.each{|bs,f| f.close()}
}
#Local variables:
# compile-command: "crystal build mercari.cr && ./mercari report_2024?.csv report_20241?.csv"
#End:
#!/usr/bin/env ruby
# coding: utf-8
# 目的 (Purpose): メルカリで暗号資産取引をしている人の確定申告 (Japanese tax return)
# 使い方 (Usage): LANG=ja_JP.UTF-8 ruby mercari.rb report_2024?.csv report_20241?.csv
# 計算書: 実行すると標準出力される年中購入または年中売却の数量と金額を国税庁の総平均法用002.xlsx計算書にコピペ
# 表計算: CSVファイルも同時に出力されるのでエクセルなどで開くと表の最下行でも年中の数量と金額がわかる
# 出力CSVファイル: btc_buy.csv, btc_sel.csv, eth_buy.csv, eth_sel.csv, xrp_buy.csv, xrp_sel.csv
# 実行例:
# $ LANG=ja_JP.UTF-8 ruby mercari.rb report_2024?.csv report_20241?.csv
# btc_buy.csv has 7 transactions. Total: 0.000411220 JPY: 4237
# btc_sel.csv has 5 transactions. Total: 0.000323540 JPY: 4680
# eth_buy.csv has 2 transactions. Total: 0.005641040 JPY: 2132
# eth_sel.csv has 2 transactions. Total: 0.000695680 JPY: 500
# xrp_buy.csv has 0 transactions. Total: 0.000000000 JPY: 0
# xrp_sel.csv has 0 transactions. Total: 0.000000000 JPY: 0
# Author: Takeshi Nishimatsu
# Licence: GPLv3
# 完全無保証: 税務署に怒られてもしりません
# 参考:
# https://help.jp.mercari.com/guide/articles/1513/ メルカル ビットコイン取引 取引報告書・損益計算方法
# ToDo:
# Use CSV library instead of split(','). But, note that:
# * Use csv gem version 3.3.3 or higher. https://rubygems.org/gems/csv
# * Old CSV.filter can't read more than two files from ARGF. https://github.com/ruby/csv/issues/328
# * We can't remove any rows by CSV.filter. https://github.com/ruby/csv/discussions/293
# 2025年の月間取引報告書CSVファイルでテスト
##
class OutputCSV
def initialize(coin,bs)
@buy_or_sell = bs
@filename = coin+"_"+bs+".csv"
@file = File.open(@filename, "w")
@file << "取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考\n"
@counter = 1 # Line number counter for the output CSV file
@total = 0.0 # 数量
@jpy = 0 # 金額
end
def transaction(line, add, yen)
@file << line
@counter += 1
@total += add.to_f
@jpy += yen.to_i
end
def close() # Before closing, add a SUM line in the end of the file.
printf("%s has %3i transactions. Total: %.9f JPY: %7i\n", @filename, @counter-1, @total, @jpy)
if @buy_or_sell=="buy"
@file << ",,,,,=SUM(F2:F#{@counter}),,,=SUM(I2:I#{@counter}),,,,,,,,,\n"
elsif @buy_or_sell=="sel"
@file << ",,,,,,,=SUM(H2:H#{@counter}),=SUM(I2:I#{@counter}),,,,,,,,,\n"
end
@file.close
end
end
# コインの種類×2個のCSV出力ファイルを*2次元*hashとして用意
files = {"btc"=>{}, "eth"=>{}, "xrp"=>{}}
files.each{|coin,h|
["buy", "sel"].each{|bs| h[bs]=OutputCSV.new(coin,bs)}
}
# コマンドライン引数で与えられた月間取引報告書CSVファイルを読み込み
ARGF.each do |line|
row = line.split(',')
if row[0] =~ /^20[2-9][0-9]/
files.each{|coin,h|
cu = coin.upcase
if row[1]=="購入" && (row[3]=="#{cu}/JPY" || row[3]=="#{cu}/POINT")
h["buy"].transaction(line, row[5], row[8])
elsif row[1]=="受取" && row[3]==cu
h["buy"].transaction(line, row[5], row[8])
h["sel"].transaction(line, row[7], row[8])
elsif row[1]=="売却" && row[3]=="#{cu}/JPY"
h["sel"].transaction(line, row[7], row[8])
end
}
end
end
# 年中購入または年中売却の数量と金額を書き出して出力CSVファイルをclose
files.each{|coin,h|
h.each{|bs,f| f.close()}
}
#Local variables:
# compile-command: "./test2024.sh"
#End:
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 15 columns, instead of 18 in line 3.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2024/10/31 14:58:17,入金,,JPY,JPY,1319,,,,,,,関東00030,株式会社メルコイン,
2024/10/31 14:58:19,購入,自己,BTC/JPY,BTC,0.00011633,JPY,1319,1319,11338135,,,関東00030,株式会社メルコイン,
,,,,,,,,,,,,,,,作成基準日時:2024/10/31 23:59:59,,
,,,,,,,,,,,,,,,作成対象期間:2024/10/1~2024/10/31,,
,,,,,,,,,,,,,,,月末残高,,
,,,,,,,,,,,,,,,JPY,BTC,ETH
,,,,,,,,,,,,,,,0,0.00035113,0.00564104
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 15 columns, instead of 18 in line 5.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2024/11/8 10:36:00,売却,自己,ETH/JPY,JPY,300,ETH,0.00069568,300,431236,,,関東00030,株式会社メルコイン,
2024/11/8 10:36:23,出金,,JPY,,,JPY,300,,,,,関東00030,株式会社メルコイン,
2024/11/16 06:11:29,出金,,JPY,,,JPY,2700,,,,,関東00030,株式会社メルコイン,暗号資産決済
2024/11/16 06:11:29,売却,自己,BTC/JPY,JPY,2700,BTC,0.00019615,2700,13764977,,,関東00030,株式会社メルコイン,暗号資産決済
,,,,,,,,,,,,,,,作成基準日時:2024/11/30 23:59:59,,
,,,,,,,,,,,,,,,作成対象期間:2024/11/1~2024/11/30,,
,,,,,,,,,,,,,,,月末残高,,
,,,,,,,,,,,,,,,JPY,BTC,ETH
,,,,,,,,,,,,,,,0,0.00015498,0.00494536
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 15 columns, instead of 18 in line 3.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2024/12/24 08:17:37,出金,,JPY,,,JPY,980,,,,,関東00030,株式会社メルコイン,暗号資産決済
2024/12/24 08:17:37,売却,自己,BTC/JPY,JPY,980,BTC,0.0000673,980,14562799,,,関東00030,株式会社メルコイン,暗号資産決済
,,,,,,,,,,,,,,,作成基準日時:2024/12/31 23:59:59,,
,,,,,,,,,,,,,,,作成対象期間:2024/12/1~2024/12/31,,
,,,,,,,,,,,,,,,月末残高,,
,,,,,,,,,,,,,,,JPY,BTC,ETH
,,,,,,,,,,,,,,,0,0.00008768,0.00494536
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 15 columns, instead of 17 in line 5.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2024/3/17 16:07:32,受取,,BTC,BTC,0.00005032,,,500,9935037,,,関東00030,株式会社メルコイン,キャンペーン付与
2024/3/17 16:08:14,入金,,JPY,JPY,941,,,,,,,関東00030,株式会社メルコイン,
2024/3/17 16:08:38,購入,自己,BTC/JPY,BTC,0.0000947,JPY,941,941,9936499,,,関東00030,株式会社メルコイン,
2024/3/17 16:08:38,購入,自己,BTC/POINT,BTC,0.0000005,MERPAY_POINT,5,5,9936499,,,関東00030,株式会社メルコイン,
,,,,,,,,,,,,,,,作成基準日時:2024/3/31 23:59:59,
,,,,,,,,,,,,,,,作成対象期間:2024/3/1~2024/3/31,
,,,,,,,,,,,,,,,月末残高,
,,,,,,,,,,,,,,,JPY,BTC
,,,,,,,,,,,,,,,0,0.00014552
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 15 columns, instead of 17 in line 3.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2024/4/26 18:42:54,出金,,JPY,,,JPY,100,,,,,関東00030,株式会社メルコイン,暗号資産決済
2024/4/26 18:42:54,売却,自己,BTC/JPY,JPY,100,BTC,0.00001011,100,9897581,,,関東00030,株式会社メルコイン,暗号資産決済
,,,,,,,,,,,,,,,作成基準日時:2024/4/30 23:59:59,
,,,,,,,,,,,,,,,作成対象期間:2024/4/1~2024/4/30,
,,,,,,,,,,,,,,,月末残高,
,,,,,,,,,,,,,,,JPY,BTC
,,,,,,,,,,,,,,,0,0.00013541
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 15 columns, instead of 18 in line 3.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2024/5/27 11:37:00,入金,,JPY,JPY,582,,,,,,,関東00030,株式会社メルコイン,
2024/5/27 11:37:02,購入,自己,BTC/JPY,BTC,0.00005249,JPY,582,582,11086191,,,関東00030,株式会社メルコイン,
,,,,,,,,,,,,,,,作成基準日時:2024/5/31 23:59:59,,
,,,,,,,,,,,,,,,作成対象期間:2024/5/1~2024/5/31,,
,,,,,,,,,,,,,,,月末残高,,
,,,,,,,,,,,,,,,JPY,BTC,ETH
,,,,,,,,,,,,,,,0,0.0001879,0
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 15 columns, instead of 18 in line 1.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
,,,,,,,,,,,,,,,作成基準日時:2024/6/30 23:59:59,,
,,,,,,,,,,,,,,,作成対象期間:2024/6/1~2024/6/30,,
,,,,,,,,,,,,,,,月末残高,,
,,,,,,,,,,,,,,,JPY,BTC,ETH
,,,,,,,,,,,,,,,0,0.0001879,0
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 15 columns, instead of 18 in line 1.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
,,,,,,,,,,,,,,,作成基準日時:2024/7/31 23:59:59,,
,,,,,,,,,,,,,,,作成対象期間:2024/7/1~2024/7/31,,
,,,,,,,,,,,,,,,月末残高,,
,,,,,,,,,,,,,,,JPY,BTC,ETH
,,,,,,,,,,,,,,,0,0.0001879,0
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 15 columns, instead of 18 in line 4.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2024/8/6 14:24:33,入金,,JPY,JPY,1932,,,,,,,関東00030,株式会社メルコイン,
2024/8/6 14:24:36,購入,自己,ETH/JPY,ETH,0.00511182,JPY,1932,1932,377947,,,関東00030,株式会社メルコイン,
2024/8/6 14:24:37,受取,,ETH,ETH,0.00052922,,,200,377914,,,関東00030,株式会社メルコイン,キャンペーン付与
,,,,,,,,,,,,,,,作成基準日時:2024/8/31 23:59:59,,
,,,,,,,,,,,,,,,作成対象期間:2024/8/1~2024/8/31,,
,,,,,,,,,,,,,,,月末残高,,
,,,,,,,,,,,,,,,JPY,BTC,ETH
,,,,,,,,,,,,,,,0,0.0001879,0.00564104
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 15 columns, instead of 18 in line 6.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2024/9/16 13:02:59,出金,,JPY,,,JPY,400,,,,,関東00030,株式会社メルコイン,暗号資産決済
2024/9/16 13:02:59,売却,自己,BTC/JPY,JPY,400,BTC,0.00004998,400,8003826,,,関東00030,株式会社メルコイン,暗号資産決済
2024/9/20 11:48:41,入金,,JPY,JPY,690,,,,,,,関東00030,株式会社メルコイン,
2024/9/20 11:48:44,購入,自己,BTC/JPY,BTC,0.00007511,JPY,690,690,9186034,,,関東00030,株式会社メルコイン,
2024/9/20 11:48:44,購入,自己,BTC/POINT,BTC,0.00002177,MERPAY_POINT,200,200,9186034,,,関東00030,株式会社メルコイン,
,,,,,,,,,,,,,,,作成基準日時:2024/9/30 23:59:59,,
,,,,,,,,,,,,,,,作成対象期間:2024/9/1~2024/9/30,,
,,,,,,,,,,,,,,,月末残高,,
,,,,,,,,,,,,,,,JPY,BTC,ETH
,,,,,,,,,,,,,,,0,0.0002348,0.00564104
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 15 columns, instead of 18 in line 1.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
,,,,,,,,,,,,,,,作成基準日時:2025/1/31 23:59:59,,
,,,,,,,,,,,,,,,作成対象期間:2025/1/1~2025/1/31,,
,,,,,,,,,,,,,,,月末残高,,
,,,,,,,,,,,,,,,JPY,BTC,ETH
,,,,,,,,,,,,,,,0,0.00008768,0.00494536
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 15 columns, instead of 19 in line 1.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
,,,,,,,,,,,,,,,作成基準日時:2025/10/31 23:59:59,,,
,,,,,,,,,,,,,,,作成対象期間:2025/10/1~2025/10/31,,,
,,,,,,,,,,,,,,,月末残高,,,
,,,,,,,,,,,,,,,JPY,BTC,ETH,XRP
,,,,,,,,,,,,,,,0,0.00005901,0.01237151,1.20827
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 15 columns, instead of 18 in line 6.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2025/2/14 22:20:25,入金,,JPY,JPY,3150,,,,,,,関東00030,株式会社メルコイン,
2025/2/14 22:20:28,購入,自己,ETH/JPY,ETH,0.00739563,JPY,3150,3150,425927,,,関東00030,株式会社メルコイン,
2025/2/14 22:20:28,購入,自己,ETH/POINT,ETH,0.00003052,MERPAY_POINT,13,13,425927,,,関東00030,株式会社メルコイン,
2025/2/14 22:21:16,入金,,JPY,JPY,3000,,,,,,,関東00030,株式会社メルコイン,
2025/2/14 22:21:17,購入,自己,BTC/JPY,BTC,0.0001983,JPY,3000,3000,15128200,,,関東00030,株式会社メルコイン,
,,,,,,,,,,,,,,,作成基準日時:2025/2/28 23:59:59,,
,,,,,,,,,,,,,,,作成対象期間:2025/2/1~2025/2/28,,
,,,,,,,,,,,,,,,月末残高,,
,,,,,,,,,,,,,,,JPY,BTC,ETH
,,,,,,,,,,,,,,,0,0.00028598,0.01237151
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 15 columns, instead of 18 in line 1.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
,,,,,,,,,,,,,,,作成基準日時:2025/3/31 23:59:59,,
,,,,,,,,,,,,,,,作成対象期間:2025/3/1~2025/3/31,,
,,,,,,,,,,,,,,,月末残高,,
,,,,,,,,,,,,,,,JPY,BTC,ETH
,,,,,,,,,,,,,,,0,0.00028598,0.01237151
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 15 columns, instead of 19 in line 4.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2025/4/13 05:18:59,購入,自己,BTC/POINT,BTC,0.00000119,MERPAY_POINT,15,15,12571909,,,関東00030,株式会社メルコイン,
2025/4/21 21:03:59,入金,,JPY,JPY,60,,,,,,,関東00030,株式会社メルコイン,
2025/4/21 21:04:01,購入,自己,BTC/JPY,BTC,0.00000477,JPY,60,60,12556795,,,関東00030,株式会社メルコイン,
,,,,,,,,,,,,,,,作成基準日時:2025/4/30 23:59:59,,,
,,,,,,,,,,,,,,,作成対象期間:2025/4/1~2025/4/30,,,
,,,,,,,,,,,,,,,月末残高,,,
,,,,,,,,,,,,,,,JPY,BTC,ETH,XRP
,,,,,,,,,,,,,,,0,0.00029194,0.01237151,0
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 15 columns, instead of 19 in line 3.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2025/5/24 10:49:04,出金,,JPY,,,JPY,3700,,,,,関東00030,株式会社メルコイン,暗号資産決済
2025/5/24 10:49:04,売却,自己,BTC/JPY,JPY,3700,BTC,0.00024716,3700,14970517,,,関東00030,株式会社メルコイン,暗号資産決済
,,,,,,,,,,,,,,,作成基準日時:2025/5/31 23:59:59,,,
,,,,,,,,,,,,,,,作成対象期間:2025/5/1~2025/5/31,,,
,,,,,,,,,,,,,,,月末残高,,,
,,,,,,,,,,,,,,,JPY,BTC,ETH,XRP
,,,,,,,,,,,,,,,0,0.00004478,0.01237151,0
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 15 columns, instead of 19 in line 3.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2025/6/6 10:47:39,購入,自己,XRP/POINT,XRP,0.022026,MERPAY_POINT,7,7,317.8,,,関東00030,株式会社メルコイン,
2025/6/6 10:47:41,受取,,XRP,XRP,0.629306,,,200,317.81,,,関東00030,株式会社メルコイン,キャンペーン付与
,,,,,,,,,,,,,,,作成基準日時:2025/6/30 23:59:59,,,
,,,,,,,,,,,,,,,作成対象期間:2025/6/1~2025/6/30,,,
,,,,,,,,,,,,,,,月末残高,,,
,,,,,,,,,,,,,,,JPY,BTC,ETH,XRP
,,,,,,,,,,,,,,,0,0.00004478,0.01237151,0.651332
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 15 columns, instead of 19 in line 5.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2025/7/15 15:01:16,入金,,JPY,JPY,239,,,,,,,関東00030,株式会社メルコイン,
2025/7/15 15:01:18,購入,自己,XRP/JPY,XRP,0.537428,JPY,239,239,444.71,,,関東00030,株式会社メルコイン,
2025/7/22 09:10:30,出金,,JPY,,,JPY,343,,,,,関東00030,株式会社メルコイン,暗号資産決済
2025/7/22 09:10:30,売却,自己,BTC/JPY,JPY,343,BTC,0.00002028,343,16918486,,,関東00030,株式会社メルコイン,暗号資産決済
,,,,,,,,,,,,,,,作成基準日時:2025/7/31 23:59:59,,,
,,,,,,,,,,,,,,,作成対象期間:2025/7/1~2025/7/31,,,
,,,,,,,,,,,,,,,月末残高,,,
,,,,,,,,,,,,,,,JPY,BTC,ETH,XRP
,,,,,,,,,,,,,,,0,0.0000245,0.01237151,1.18876
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 15 columns, instead of 19 in line 2.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2025/8/9 05:30:27,購入,自己,XRP/POINT,XRP,0.01951,MERPAY_POINT,10,10,512.54,,,関東00030,株式会社メルコイン,
,,,,,,,,,,,,,,,作成基準日時:2025/8/31 23:59:59,,,
,,,,,,,,,,,,,,,作成対象期間:2025/8/1~2025/8/31,,,
,,,,,,,,,,,,,,,月末残高,,,
,,,,,,,,,,,,,,,JPY,BTC,ETH,XRP
,,,,,,,,,,,,,,,0,0.0000245,0.01237151,1.20827
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 15 columns, instead of 19 in line 6.
取引日時,取引種別,取引形態,通貨ペア,増加通貨名,増加数量,減少通貨名,減少数量,約定金額,約定価格,手数料通貨,手数料数量,登録番号,社名,備考
2025/9/10 08:40:34,入金,,JPY,JPY,289,,,,,,,関東00030,株式会社メルコイン,
2025/9/10 08:40:37,購入,自己,BTC/JPY,BTC,0.00001718,JPY,289,289,16814992,,,関東00030,株式会社メルコイン,
2025/9/10 08:40:37,購入,自己,BTC/POINT,BTC,0.00000077,MERPAY_POINT,13,13,16814992,,,関東00030,株式会社メルコイン,
2025/9/12 17:05:51,入金,,JPY,JPY,289,,,,,,,関東00030,株式会社メルコイン,
2025/9/12 17:05:53,購入,自己,BTC/JPY,BTC,0.00001656,JPY,289,289,17449615,,,関東00030,株式会社メルコイン,
,,,,,,,,,,,,,,,作成基準日時:2025/9/30 23:59:59,,,
,,,,,,,,,,,,,,,作成対象期間:2025/9/1~2025/9/30,,,
,,,,,,,,,,,,,,,月末残高,,,
,,,,,,,,,,,,,,,JPY,BTC,ETH,XRP
,,,,,,,,,,,,,,,0,0.00005901,0.01237151,1.20827
#!/bin/bash
##
LANG=ja_JP.UTF-8 ruby mercari.rb report_2024?.csv report_20241?.csv &&
wc -l btc_buy.csv | grep '9 btc_buy.csv' &&
wc -l btc_sel.csv | grep '7 btc_sel.csv' &&
wc -l eth_buy.csv | grep '4 eth_buy.csv' &&
wc -l eth_sel.csv | grep '4 eth_sel.csv' &&
echo -n -e " \033[1;32mmercaro.rb passed some tests!\033[0;39m\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment