Exemple #1
0
def main():
    parser = argparse.ArgumentParser(description='TickTrader Web API sample')
    parser.add_argument('web_api_address', help='TickTrader Web API address')
    parser.add_argument('web_api_id',
                        default=None,
                        help='TickTrader Web API Id')
    parser.add_argument('web_api_key',
                        default=None,
                        help='TickTrader Web API Key')
    parser.add_argument('web_api_secret',
                        default=None,
                        help='TickTrader Web API Secret')
    args = parser.parse_args()

    # Create instance of the TickTrader Web API client
    client = TickTraderWebClient(args.web_api_address, args.web_api_id,
                                 args.web_api_key, args.web_api_secret)

    # Account positions
    account = client.get_account()
    if account['AccountingType'] == 'Net':
        positions = client.get_all_positions()
        for p in positions:
            print('{0} position: {1} {2}'.format(p['Symbol'], p['LongAmount'],
                                                 p['ShortAmount']))
def main():
    parser = argparse.ArgumentParser(description='TickTrader Web API sample')
    parser.add_argument('web_api_address', help='TickTrader Web API address')
    parser.add_argument('web_api_id', default=None, help='TickTrader Web API Id')
    parser.add_argument('web_api_key', default=None, help='TickTrader Web API Key')
    parser.add_argument('web_api_secret', default=None, help='TickTrader Web API Secret')
    args = parser.parse_args()

    # Create instance of the TickTrader Web API client
    client = TickTraderWebClient(args.web_api_address, args.web_api_id, args.web_api_key, args.web_api_secret)

    # Create, modify and cancel limit order
    account = client.get_account()
    if (account['AccountingType'] == 'Gross') or (account['AccountingType'] == 'Net'):

        # Create limit order
        limit = client.create_trade(
            {
                'Type': 'Limit',
                'Side': 'Buy',
                'Symbol': 'EURUSD' if (account['AccountingType'] == 'Gross') else 'EUR/USD',
                'Amount': 10000,
                'Price': 1.0,
                'Comment': 'Buy limit from Web API sample'
            })

        # Modify limit order
        limit = client.modify_trade(
            {
                'Id': limit['Id'],
                'Comment': 'Modified limit from Web API sample'
            })

        # Cancel limit order
        client.cancel_trade(limit['Id'])
Exemple #3
0
def main():
    parser = argparse.ArgumentParser(description='TickTrader Web API sample')
    parser.add_argument('web_api_address', help='TickTrader Web API address')
    parser.add_argument('web_api_id',
                        default=None,
                        help='TickTrader Web API Id')
    parser.add_argument('web_api_key',
                        default=None,
                        help='TickTrader Web API Key')
    parser.add_argument('web_api_secret',
                        default=None,
                        help='TickTrader Web API Secret')
    args = parser.parse_args()

    # Create instance of the TickTrader Web API client
    client = TickTraderWebClient(args.web_api_address, args.web_api_id,
                                 args.web_api_key, args.web_api_secret)

    # Create, modify and cancel limit order
    account = client.get_account()
    if (account['AccountingType'] == 'Gross') or (account['AccountingType']
                                                  == 'Net'):

        # Create limit order
        limit = client.create_trade({
            'Type':
            'Limit',
            'Side':
            'Buy',
            'Symbol':
            'EURUSD' if (account['AccountingType'] == 'Gross') else 'EUR/USD',
            'Amount':
            10000,
            'Price':
            1.0,
            'Comment':
            'Buy limit from Web API sample'
        })

        # Modify limit order
        limit = client.modify_trade({
            'Id':
            limit['Id'],
            'Comment':
            'Modified limit from Web API sample'
        })

        # Cancel limit order
        client.cancel_trade(limit['Id'])
Exemple #4
0
def main():
    parser = argparse.ArgumentParser(description='TickTrader Web API sample')
    parser.add_argument('web_api_address', help='TickTrader Web API address')
    parser.add_argument('web_api_id', default=None, help='TickTrader Web API Id')
    parser.add_argument('web_api_key', default=None, help='TickTrader Web API Key')
    parser.add_argument('web_api_secret', default=None, help='TickTrader Web API Secret')
    args = parser.parse_args()

    # Create instance of the TickTrader Web API client
    client = TickTraderWebClient(args.web_api_address, args.web_api_id, args.web_api_key, args.web_api_secret)

    # Account info
    account = client.get_account()
    print('Account Id: {0}'.format(account['Id']))
    print('Account name: {0}'.format(account['Name']))
    print('Account group: {0}'.format(account['Group']))
def main():
    parser = argparse.ArgumentParser(description='TickTrader Web API sample')
    parser.add_argument('web_api_address', help='TickTrader Web API address')
    parser.add_argument('web_api_id', default=None, help='TickTrader Web API Id')
    parser.add_argument('web_api_key', default=None, help='TickTrader Web API Key')
    parser.add_argument('web_api_secret', default=None, help='TickTrader Web API Secret')
    args = parser.parse_args()

    # Create instance of the TickTrader Web API client
    client = TickTraderWebClient(args.web_api_address, args.web_api_id, args.web_api_key, args.web_api_secret)

    # Account positions
    account = client.get_account()
    if account['AccountingType'] == 'Net':
        positions = client.get_all_positions()
        for p in positions:
            print('{0} position: {1} {2}'.format(p['Symbol'], p['LongAmount'], p['ShortAmount']))
Exemple #6
0
def main():
    parser = argparse.ArgumentParser(description='TickTrader Web API sample')
    parser.add_argument('web_api_address', help='TickTrader Web API address')
    parser.add_argument('web_api_id', default=None, help='TickTrader Web API Id')
    parser.add_argument('web_api_key', default=None, help='TickTrader Web API Key')
    parser.add_argument('web_api_secret', default=None, help='TickTrader Web API Secret')
    args = parser.parse_args()

    # Create instance of the TickTrader Web API client
    client = TickTraderWebClient(args.web_api_address, args.web_api_id, args.web_api_key, args.web_api_secret)

    # Account assets
    account = client.get_account()
    if account['AccountingType'] == 'Cash':
        assets = client.get_all_assets()
        for a in assets:
            print('{0} asset: {1}'.format(a['Currency'], a['Amount']))
def main():
    parser = argparse.ArgumentParser(description='TickTrader Web API sample')
    parser.add_argument('web_api_address', help='TickTrader Web API address')
    parser.add_argument('web_api_id',
                        default=None,
                        help='TickTrader Web API Id')
    parser.add_argument('web_api_key',
                        default=None,
                        help='TickTrader Web API Key')
    parser.add_argument('web_api_secret',
                        default=None,
                        help='TickTrader Web API Secret')
    args = parser.parse_args()

    # Create instance of the TickTrader Web API client
    client = TickTraderWebClient(args.web_api_address, args.web_api_id,
                                 args.web_api_key, args.web_api_secret)

    # Account info
    account = client.get_account()
    print('Account Id: {0}'.format(account['Id']))
    print('Account name: {0}'.format(account['Name']))
    print('Account group: {0}'.format(account['Group']))
Exemple #8
0
def main():
    parser = argparse.ArgumentParser(description='TickTrader Web API sample')
    parser.add_argument('web_api_address', help='TickTrader Web API address')
    parser.add_argument('web_api_id',
                        default=None,
                        help='TickTrader Web API Id')
    parser.add_argument('web_api_key',
                        default=None,
                        help='TickTrader Web API Key')
    parser.add_argument('web_api_secret',
                        default=None,
                        help='TickTrader Web API Secret')
    args = parser.parse_args()

    # Create instance of the TickTrader Web API client
    client = TickTraderWebClient(args.web_api_address, args.web_api_id,
                                 args.web_api_key, args.web_api_secret)

    # Account assets
    account = client.get_account()
    if account['AccountingType'] == 'Cash':
        assets = client.get_all_assets()
        for a in assets:
            print('{0} asset: {1}'.format(a['Currency'], a['Amount']))