Exemplo n.º 1
0
def ct(purchase):
	if purchase.Category == "CLOTHING" and purchase.Price > 50.00:
		purchase.Price = compute_tax(purchase.Price, .06)	
	elif purchase.Category == "CLOTHING":
		purchase.Price = purchase.Price
	elif purchase.Category == "SUBSCRIPTIONS":
		purchase.Price = compute_tax(purchase.Price, .03)
	else:
		purchase.Price = compute_tax(purchase.Price, .06)
Exemplo n.º 2
0
def ny(purchase):
	
	#NYC waves tax for clothing items under $110
	if purchase.Category == "CLOTHING" and purchase.Price < 110.00 and purchase.City == "New York":
		purchase.Price = compute_tax(purchase.Price, .04375)
	elif purchase.City == "New York":
		purchase.Price = compute_tax(purchase.Price, .08375)
	else:
		purchase.Price = compute_tax(purchase.Price, .04)
Exemplo n.º 3
0
parser.add_argument('--rounding-report-threshold', help='The number of percent difference required for an amount to be included in the report.', default='1')
parser.add_argument('--cointracking-usd', help='Use this flag if you have configured cointracking calculate prices in USD. Conversion from USD to SEK will then be done by this script instead.', action='store_true')
parser.add_argument('--max-overdraft', type=float, help='The maximum overdraft to allow for each coin, at the event of an overdraft the coin balance will be set to zero.', default=1e-9)
opts = parser.parse_args()

if not os.path.isdir(opts.out):
    os.makedirs(opts.out)

personal_details = PersonalDetails.read_from("data/personal_details.json")
trades = Trades.read_from(opts.trades, opts.cointracking_usd)
stock_tax_events = TaxEvent.read_stock_tax_events_from("data/stocks.json") if os.path.exists("data/stocks.json") else None

tax_events = tax.compute_tax(trades,
                             datetime.datetime(year=opts.year,month=1,day=1,hour=0, minute=0),
                             datetime.datetime(year=opts.year,month=12,day=31,hour=23, minute=59),
                             opts.max_overdraft,
                             exclude_groups=opts.exclude_groups if opts.exclude_groups else [],
                             coin_report_filename=os.path.join(opts.out, "coin_report.csv") if opts.coin_report else None
                             )
if tax_events is None:
    print(f"Aborting tax computation.")
    sys.exit(1)

if opts.simplified_k4:
    tax_events = tax.aggregate_per_coin(tax_events)

if opts.format == Format.sru and not opts.decimal_sru:
    if opts.rounding_report:
        threshold = float(opts.rounding_report_threshold) / 100.0
        tax.rounding_report(tax_events, threshold, os.path.join(opts.out, "rounding_report.txt"))
    tax_events = tax.convert_to_integer_amounts(tax_events)
Exemplo n.º 4
0
def ma(purchase):
	
	if purchase.Category != "SUBSCRIPTIONS":
		purchase.Price = compute_tax(purchase.Price, .05)
Exemplo n.º 5
0
parser.add_argument('--exclude-groups', nargs='*', help='Exclude cointracking group from report')
parser.add_argument('--coin-report', help='Generate report of remaining coins and their cost basis at end of year', action='store_true')
opts = parser.parse_args()

personal_details = PersonalDetails.read_from("data/personal_details.json")
trades = Trades.read_from(opts.trades)
if os.path.exists("data/fees.csv"):
    fees = Trades.read_fees_from("data/fees.csv")
    trades.trades.extend(fees.trades)
    trades.trades.sort(key=lambda x: x.date)

stock_tax_events = TaxEvent.read_stock_tax_events_from("data/stocks.json") if os.path.exists("data/stocks.json") else None

tax_events = tax.compute_tax(trades,
                             datetime.datetime(year=opts.year,month=1,day=1,hour=0, minute=0),
                             datetime.datetime(year=opts.year,month=12,day=31,hour=23, minute=59),
                             exclude_groups=opts.exclude_groups if opts.exclude_groups else [],
                             coin_report_filename="out/coin_report.csv" if opts.coin_report else None
                             )

if opts.format == Format.sru and not opts.decimal_sru:
    tax_events = tax.convert_to_integer_amounts(tax_events)

tax_events = tax.convert_sek_to_integer_amounts(tax_events)

pages = tax.generate_k4_pages(opts.year, personal_details, tax_events, stock_tax_events=stock_tax_events)

if opts.format == Format.sru:
    tax.generate_k4_sru(pages, personal_details, "out")
elif opts.format == Format.pdf:
    tax.generate_k4_pdf(pages, "out")