keyboard shortcuts for trading

Add your new features and requests here.
mdtrader
Posts: 39
Joined: Sat Oct 27, 2018 4:05 pm
Location: germany
Has thanked: 13 times
Been thanked: 36 times

keyboard shortcuts for trading

Post by mdtrader » Mon Jan 21, 2019 6:50 pm

is it possible to define custom keyboard shortcuts for trading commands like
buy/sell limit/market
move stop +/- 1tick
move target +/-1tick

The reason is, I use a trading keyboard for trading via SierraChart and it's faster then using the mouse but it works not with Bookmap generated orders, would be great to use it with Bookmap also

thanks

Swishy27
Posts: 5
Joined: Sun Mar 03, 2019 2:45 pm
Has thanked: 3 times
Been thanked: 6 times

Re: keyboard shortcuts for trading

Post by Swishy27 » Sun Aug 04, 2019 1:30 pm

I second this recommendation.  This is especially useful in fast markets where point and click execution is a liability.

rutariq
Posts: 1
Joined: Mon Feb 11, 2019 4:17 am
Has thanked: 1 time
Been thanked: 1 time

Re: keyboard shortcuts for trading

Post by rutariq » Wed Aug 07, 2019 10:45 pm

Totally agree, keyboard shortcuts are way more in control rather pinpointing mouse generated order.

Most of the trade apps offer kb shortcuts:

LMT B/S
MKT B/S
Increase/Decrease LMT orders & STP orders
Preset Bracket orders
Close/Flaten/Reverse

AndreyR
Posts: 131
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 9 times
Been thanked: 37 times

Re: keyboard shortcuts for trading

Post by AndreyR » Thu Aug 08, 2019 5:49 am

Hi all,
you may want to implement these features yourself.
Use Simplified interface, create a KeyEventDispatcher object and assign keys to desired actions.
Here's an example:

Code: Select all

 
package com.bookmap.api.simple.simplified;

import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;

import velox.api.layer1.annotations.Layer1ApiVersion;
import velox.api.layer1.annotations.Layer1ApiVersionValue;
import velox.api.layer1.annotations.Layer1SimpleAttachable;
import velox.api.layer1.annotations.Layer1StrategyName;
import velox.api.layer1.annotations.Layer1TradingStrategy;
import velox.api.layer1.common.Log;
import velox.api.layer1.data.ExecutionInfo;
import velox.api.layer1.data.InstrumentInfo;
import velox.api.layer1.data.OrderInfoUpdate;
import velox.api.layer1.simplified.Api;
import velox.api.layer1.simplified.CustomModule;
import velox.api.layer1.simplified.OrdersListener;
import velox.api.layer1.simplified.InitialState;
import velox.api.layer1.data.OrderSendParameters;
import velox.api.layer1.data.SimpleOrderSendParametersBuilder;

@Layer1SimpleAttachable
@Layer1StrategyName("Send Order By Key")
@Layer1ApiVersion(Layer1ApiVersionValue.VERSION1)
@Layer1TradingStrategy
public class SendOrderByKey implements CustomModule, OrdersListener {
    Api api;
    private String alias;
    private KeyEventDispatcher customDispatcher;
    List<OrderInfoUpdate> list = new ArrayList<>();
    
    String orderAliasTarget;
    String orderAliasStop;
    int updateCount;

    @Override
    public void initialize(String alias, InstrumentInfo info, Api api, InitialState initialState) {
        this.alias = alias;
        this.api = api;
        listenForKey();
    }

    @Override
    public void stop() {
        KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(customDispatcher);
    }
    
    private void sendMarketOrber (boolean isBuy ) {
        if (isBuy) {
        SimpleOrderSendParametersBuilder shortOrderSendParameters = new  SimpleOrderSendParametersBuilder (alias, false, 1);
        shortOrderSendParameters.setSize(10);
        shortOrderSendParameters.setBuy(isBuy);
        OrderSendParameters shortOrder = shortOrderSendParameters.build();
        api.sendOrder(shortOrder);
        
        } else {
            SimpleOrderSendParametersBuilder OrderSendParameters = new SimpleOrderSendParametersBuilder (alias, false, 1);
            OrderSendParameters.setLimitPrice(6300);
            OrderSendParameters.setSize(10);
            OrderSendParameters.setBuy(isBuy);
            OrderSendParameters.setTakeProfitOffset(5);
            OrderSendParameters.setStopLossOffset(6);
            OrderSendParameters.setStopLossClientId(isBuy?"longStop":"shortStop");
            OrderSendParameters.setTakeProfitClientId(isBuy?"longTarget":"shortTarget");            
            OrderSendParameters orderParam = OrderSendParameters.build();
            orderAliasStop = OrderSendParameters.getStopLossClientId();
            orderAliasTarget= OrderSendParameters.getTakeProfitClientId();
            api.sendOrder(orderParam);
        }
        
    }

    private void listenForKey() {
        customDispatcher = new KeyEventDispatcher() {
            @Override
            public boolean dispatchKeyEvent(KeyEvent e) {
                switch (e.getID()) {
                case KeyEvent.KEY_PRESSED:
                    if (e.getKeyChar() == 'b') {
                        sendMarketOrber(true);
                    }
                    if (e.getKeyChar() == 's') {
                        sendMarketOrber(false);
                    }
                    break;
                case KeyEvent.KEY_RELEASED:
                    break;
                case KeyEvent.KEY_TYPED:
                    break;
                }
                return false;
            }
        };
        
        KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(customDispatcher);
    }
    
    @Override
    public void onOrderUpdated(OrderInfoUpdate orderInfoUpdate) {
        list.add(orderInfoUpdate);
        Log.info("UPDATE " + updateCount++);
    }

    @Override
    public void onOrderExecuted(ExecutionInfo executionInfo) {
        // TODO Auto-generated method stub
    }
}

IntheZone
Posts: 27
Joined: Tue May 07, 2019 6:33 pm
Has thanked: 16 times
Been thanked: 4 times

Re: keyboard shortcuts for trading

Post by IntheZone » Tue Aug 13, 2019 1:56 pm

ANDREW --
Thanks for the code -- it looks awesome.

I also need these keyboard shortcuts.

how exaclty do we add this code / make the API?  Is there a video we can see to do it?  Thanks a million!

AndreyR
Posts: 131
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 9 times
Been thanked: 37 times

Re: keyboard shortcuts for trading

Post by AndreyR » Tue Aug 13, 2019 3:25 pm

Hi IntheZone,
the code I have posted is a sample 'custom user module' created for Bookmap with a Simplified API. Take a look at this package
https://github.com/BookmapAPI/DemoStrategies
There's a brief overview in the Doc folder. You are welcome to ask your questions if something goes wrong.
There are a bunch of simplified demo strategies in that package, take a look at them. they are created with a very simple yet powerful Simplified interface. To make your module work just extend some simple interfaces, launch your strategy to Bookmap and voila you have your own strategy working. All you need is some software development background.

mpxtreme
Posts: 24
Joined: Thu Oct 25, 2018 12:20 am
Been thanked: 4 times

Re: keyboard shortcuts for trading

Post by mpxtreme » Sat Aug 31, 2019 5:33 am

The issue with adding our own user custom features, is that they need to be re-imported on updates or re-installs.

This feature is standard in the majority of trade execution platforms.

At least the basics.

Join Bid or Buy Limit
Buy Ask
Join Offer or Sell Limit
Sell Bid
Buy Market
Sell Market
Cancel All
Cancel All + Liquidate

Thanks
 
Last edited by mpxtreme on Mon Sep 02, 2019 4:03 am, edited 1 time in total.

IntheZone
Posts: 27
Joined: Tue May 07, 2019 6:33 pm
Has thanked: 16 times
Been thanked: 4 times

Re: keyboard shortcuts for trading

Post by IntheZone » Mon Sep 02, 2019 2:37 am

mpxtreme wrote:
Sat Aug 31, 2019 5:33 am
The issue with adding our own user custom features, is that they need to be re-imported on updates or re-installs.

This feature is standard in the majority of trade execution platforms.

At least the basics.

Join Bid
Buy Offer
Join Offer
Hit Bid
Buy Market
Sell Market
Cancel All
Cancel All + Liquidate

Thanks



Yes -- 100% we need to be able to set  Instant FLATTEN of Trade.  Definitely 100% very very important.

I also need >>> 
Move all stops to mouse pointer price or mouse pointer click price
Move all LIMIT ORDERS / Take Profits to Mouse Pointer click price

REVERSE POSITION also?

 

IntheZone
Posts: 27
Joined: Tue May 07, 2019 6:33 pm
Has thanked: 16 times
Been thanked: 4 times

Re: keyboard shortcuts for trading

Post by IntheZone » Mon Sep 02, 2019 5:59 am

AndreyR wrote:
Tue Aug 13, 2019 3:25 pm
Hi IntheZone,
the code I have posted is a sample 'custom user module' created for Bookmap with a Simplified API. Take a look at this package
https://github.com/BookmapAPI/DemoStrategies
There's a brief overview in the Doc folder. You are welcome to ask your questions if something goes wrong.
There are a bunch of simplified demo strategies in that package, take a look at them. they are created with a very simple yet powerful Simplified interface. To make your module work just extend some simple interfaces, launch your strategy to Bookmap and voila you have your own strategy working. All you need is some software development background.

Andrew -- Github pdf said we need Eclipse in 32bit?  is that true?  I could only see 64bit Eclipse download there.
Thanks

AndreyR
Posts: 131
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 9 times
Been thanked: 37 times

Re: keyboard shortcuts for trading

Post by AndreyR » Mon Sep 02, 2019 7:35 am

Oops no, thx for your comment. Use Eclipse x64 and Java 8 x64. I will fix the guide today.

Post Reply