def parse(extend=None, args=None):
    return (stdargs.Parser(
        "Get targets",
        ["portfolio", "scope", "date_range", "filename", "limit", "asat"],
    ).add("--date",
          help="YYYY-MM-DD - if provided will query the holdings").extend(
              extend).parse(args))
Пример #2
0
def parse(extend=None, args=None):
    return (stdargs.Parser(
        "Get Quotes", ["scope", "filename", "limit", "asat"]).add(
            "date", help="Date for which you require quotes").add(
                "instrument", nargs="*").add(
                    "--identifier",
                    "-i",
                    default="LusidInstrumentId",
                    help="Instrument identifer type",
                ).add("-p", "--provider", default="", help="Provider").add(
                    "-s", "--source", default="", help="Price source").add(
                        "-q",
                        "--quote-type",
                        default="Price",
                        choices=["Price", "Rate", "rate"],
                        help="quote type",
                    ).add("--field",
                          dest="field",
                          default="Mid",
                          help="quote field").add(
                              "--from",
                              dest="from_file",
                              nargs=2,
                              metavar=("filename.csv", "column"),
                              help="load values from file",
                          ).extend(extend).parse(args))
Пример #3
0
def parse(extend=None, args=None):
    return (stdargs.Parser("Upload a Portfolio", ["scope", "portfolio"]).add(
        "-t", "--transactions", help="csv or excel file of transactions"
    ).add(
        "-p",
        "--positions",
        nargs=2,
        metavar=("filename", "YYYY-MM-DD"),
        help="Positions filename and date",
    ).add(
        "-c",
        "--create",
        nargs=3,
        metavar=("DISPLAY-NAME", "CURRENCY", "YYYY-MM-DD"),
        help=
        "Provide the display-name, currency and creation date when creating a portfolio",
    ).add(
        "-a",
        "--accounting_method",
        choices=["FIFO", "LIFO", "HCF", "LCF"],
        default="AverageCost",
        help="Alternate accounting method. Default is average-cost",
    ).add("--shk", nargs="+", help="sub-holding keys").add(
        "--map",
        action="store_true",
        help="use mapping tool to set instruments").extend(extend).parse(args))
Пример #4
0
def parse(extend=None, args=None):
    return (stdargs.Parser("Upload quotes", [
        "scope", "filename"
    ]).add("input", nargs="+").add(
        "--map",
        action="store_true",
        help="use mapping tool to set instruments").extend(extend).parse(args))
Пример #5
0
def parse(extend=None, args=None):
    return (
        stdargs.Parser("Query Instruments", ["filename", "limit", "properties"])
        .add("--batch", type=int, default=2000)
        .add("--filter")
        .extend(extend)
        .parse(args)
    )
Пример #6
0
def parse(extend=None, args=None):
    return (stdargs.Parser(
        "Create property definitions", ["filename", "quiet", "NODFQ"]).add(
            "--property",
            nargs="+").add("--type",
                           default="Label",
                           choices=["Label",
                                    "Metric"]).extend(extend).parse(args))
def parse(extend=None, args=None):
    return (stdargs.Parser(
        "Get Property definitions", ["filename", "limit"]).add(
            "-s",
            "--scope",
            metavar="scope",
            help="Scope. Use default for system properties",
        ).add("-d", "--domain", metavar="domain",
              help="Property domain").extend(extend).parse(args))
Пример #8
0
def parse(extend=None, args=None):
    return (
        stdargs.Parser("Get Scopes", ["filename", "limit"])
        .add("--portfolios", action="store_true")
        .add("--batch", type=int, default=1000)
        .add("--monitor", action="store_true")
        .extend(extend)
        .parse(args)
    )
Пример #9
0
def parse(extend=None, args=None):
    return (stdargs.Parser("Map Instruments", ["filename"]).add(
        "--folder", help="include all 'txn' files in the folder").add(
            "input",
            nargs="*",
            metavar="file",
            help="file(s) containing instruments").add(
                "--column",
                metavar="input-column",
                default="instrument_uid",
                help="column name for instrument column",
            ).extend(extend).parse(args))
Пример #10
0
def parse(extend=None, args=None):
    return (stdargs.Parser("Create Orders", ["filename", "limit", "test"]).add(
        "input", nargs="+").add(
            "--mappings",
            nargs="+",
            help="column name mappings of the form TICKER=col1 etc",
        ).add(
            "--identifiers",
            nargs="+",
            default=["ClientInternal", "Figi"],
            help="Identifier types provided",
        ).extend(extend).parse(args))
def parse(extend=None, args=None):
    return (
        stdargs.Parser("Get Aggregate Holdings", ["filename", "limit", "properties"])
        .add("scope", help="Scope")
        .add("portfolio", help="Portfolio id")
        .add("dates", nargs="+", metavar="YYYY-MM_DD")
        .add("-m", "--monitor", action="store_true", help="monitor the run")
        .add("--group", action="store_true", help="group instead of portfolio")
        .add("--pricing-scope", dest="pricing_scope", help="scope for pricing")
        .add("--recipe", default="default", help="valuatione engine recipe")
        .extend(extend)
        .parse(args)
    )
Пример #12
0
def parse(extend=None, args=None):
    return (stdargs.Parser(
        "Get Instruments",
        ["filename", "limit", "asat"]).add("instrument", nargs="*").add(
            "--type", "-t", default="ClientInternal",
            help="Instrument type").add(
                "--identifiers", nargs="*", help="identifiers to display").add(
                    "--properties",
                    nargs="*",
                    help="properties required for display").add(
                        "--from",
                        dest="from_file",
                        nargs=2,
                        metavar=("filename.csv", "column"),
                        help="load values from file",
                    ).add("--effective_at").extend(extend).parse(args))
def parse(extend=None, args=None):
    return (stdargs.Parser(
        "Get Transactions",
        ["filename", "limit", "scope", "portfolio", "date_range", "asat"],
    ).add("--properties", nargs="*",
          help="properties required for display").add(
              "-t",
              "--type",
              metavar="type",
              default="input",
              choices=["input", "output"],
              help="Choose input or output",
          ).add("--cancels", action="store_true",
                help="Show cancelled trades").add(
                    "--brief",
                    action="store_true",
                    help="Show fewer data points").extend(extend).parse(args))
Пример #14
0
def parse(extend=None, args=None):
    return (stdargs.Parser("Get/Set transaction configuration", [
        "filename", "limit"
    ]).add(
        "action",
        choices=("get", "set", "try"),
        help=
        "get or set the config. 'Try' can be used to validate a custom encoding",
    ).add(
        "--raw", action="store_true", help="use raw (non custom) encoding"
    ).add(
        "--json", action="store_true", help="display the json to be sent"
    ).add("--group", action="store_true",
          help="set a single group").add(
              "--force",
              action="store_true",
              help="set a single group, remove existing aliases for the group",
          ).extend(extend).parse(args))
def parse(extend=None, args=None):
    return (
        stdargs.Parser(
            "Get Constituents",
            [
                "filename",
                "limit",
                "scope",
                "portfolio",
                "date",
                "properties",
                "asat",
                "properties",
            ],
        )
        .extend(extend)
        .parse(args)
    )
def parse(extend=None, args=None):
    return (stdargs.Parser(
        "Get Holdings Reconciliation",
        ["filename", "limit"]).add("scope_left", help="Scope - left").add(
            "portfolio_left", help="Portfolio id - left").add(
                "date_left", nargs="+", metavar="YYYY-MM_DD").add(
                    "scope_right",
                    help="Scope - right").add("portfolio_right",
                                              help="Portfolio id - right").add(
                                                  "date_right",
                                                  nargs="+",
                                                  metavar="YYYY-MM_DD").add(
                                                      "-m",
                                                      "--monitor",
                                                      action="store_true",
                                                      help="monitor the run").
            add("--group",
                action="store_true",
                help="group instead of portfolio").extend(extend).parse(args))
Пример #17
0
def parse(extend=None, args=None):
    return (stdargs.Parser(
        "Get Holdings",
        ["filename", "limit", "scope", "portfolio", "asat"]).add(
            "dates", nargs="*", metavar="YYYY-MM-DD").add(
                "-i",
                "--instrument",
                metavar="instrument-id",
                help="filter an instrument").add(
                    "-m",
                    "--monitor",
                    action="store_true",
                    help="monitor the run").add(
                        "-t",
                        "--taxlots",
                        action="store_true",
                        help="view at tax-lot level").add(
                            "--properties", nargs="+",
                            default=[]).extend(extend).parse(args))
Пример #18
0
def parse(extend=None, args=None):
    return (stdargs.Parser("Get Portfolios",
                           ["filename", "limit", "scope", "properties"
                            ]).extend(extend).parse(args))
Пример #19
0
def parse(extend=None, args=None):
    return (stdargs.Parser("Upload Prices", ["filename", "scope", "date"]).add(
        "date", metavar="YYYY-MM-DD").add("--update", action="store_true").add(
            "--fx", action="store_true").extend(extend).parse(args))
Пример #20
0
def parse(extend=None, args=None):
    return (stdargs.Parser("Get Portfolio Groups",
                           ["filename", "limit", "scope"
                            ]).add("--group").extend(extend).parse(args))
Пример #21
0
def parse(extend=None, args=None):
    return (stdargs.Parser("Get Scopes", ["filename", "limit"]).add(
        "--portfolios", action="store_true").extend(extend).parse(args))
Пример #22
0
#!/usr/bin/python3
import pandas as pd
from lusidtools.lpt import stdargs
from lusidtools.lpt import lse
from lusidtools.lpt import lpt

args = stdargs.Parser("Delete Portfolio Properties",
                      ["scope", "portfolio", "properties"]).parse()
api = lse.connect(args)

api.call.delete_portfolio_properties(
    scope=args.scope,
    code=args.portfolio,
    portfolio_property_keys=args.properties).match(
        left=lpt.display_error, right=lambda r: print("Done!"))
Пример #23
0
def parse(extend=None, args=None):
    return (stdargs.Parser("Search Instruments", ["filename", "limit"]).add(
        "--properties", nargs="*",
        help="properties to search").extend(extend).parse(args))
Пример #24
0
def parse(extend=None, args=None):
    return (stdargs.Parser(
        "Upload a Portfolio",
        ["scope", "portfolio", "input", "date"]).extend(extend).parse(args))
Пример #25
0
def parse(extend=None, args=None):
    return stdargs.Parser("Create Portfolios").add("input").extend(
        extend).parse(args)
Пример #26
0
#!/usr/bin/python3

import lusid.models as models
from lusidtools.lpt import stdargs
from lusidtools.lpt import lse
from lusidtools.lpt import lpt

args = (stdargs.Parser(
    "Set Portfolio Properties",
    ["scope", "portfolio"]).add("property").add("value").add("--date").add(
        "--metric", action="store_true").add("--test",
                                             action="store_true").parse())
api = lse.connect(args)


def metric(m):
    return api.models.PropertyValue(metric_value=models.MetricValue(
        value=float(m)))


def label(l):
    return api.models.PropertyValue(label_value=str(l))


property_request = {
    args.property:
    api.models.ModelProperty(
        key=args.property,
        value=metric(args.value) if args.metric else label(args.value),
        effective_from=lpt.to_date(args.date) if args.date else None,
    )
Пример #27
0
def parse(extend=None, args=None):
    return (stdargs.Parser("Query Instrument Identifiers",
                           ["filename", "limit"]).extend(extend).parse(args))
Пример #28
0
def parse(extend=None, args=None):
    return (stdargs.Parser("Get Portfolios",
                           ["filename", "limit", "portfolio", "scope", "asat"
                            ]).add("--date").extend(extend).parse(args))
Пример #29
0
def parse(extend=None, args=None):
    return (stdargs.Parser("Create Portfolio Groups",
                           ["scope", "filename"]).add(
                               "input", nargs="*").extend(extend).parse(args))