Add --invert option.
This commit is contained in:
parent
f5e6e01298
commit
be039d7ad8
1 changed files with 10 additions and 0 deletions
|
@ -55,6 +55,11 @@ def cmd_fetch(args):
|
||||||
)
|
)
|
||||||
for p in prices
|
for p in prices
|
||||||
]
|
]
|
||||||
|
if args.invert:
|
||||||
|
prices = [
|
||||||
|
p._replace(base=p.quote, quote=p.base, amount=(1 / p.amount))
|
||||||
|
for p in prices
|
||||||
|
]
|
||||||
|
|
||||||
time = args.renametime or "00:00:00"
|
time = args.renametime or "00:00:00"
|
||||||
print(output.format(prices, time=time), end="")
|
print(output.format(prices, time=time), end="")
|
||||||
|
@ -159,6 +164,11 @@ def build_parser():
|
||||||
default=outputs.default,
|
default=outputs.default,
|
||||||
help=f"output format (default: {outputs.default})",
|
help=f"output format (default: {outputs.default})",
|
||||||
)
|
)
|
||||||
|
fetch_parser.add_argument(
|
||||||
|
"--invert",
|
||||||
|
action="store_true",
|
||||||
|
help="invert the price, swapping base and quote",
|
||||||
|
)
|
||||||
fetch_parser.add_argument(
|
fetch_parser.add_argument(
|
||||||
"--rename-base",
|
"--rename-base",
|
||||||
dest="renamebase",
|
dest="renamebase",
|
||||||
|
|
Loading…
Add table
Reference in a new issue