input
stringlengths
10
828
output
stringlengths
5
107
public int get buffers size int r 0 for byte buffer b get buffers r b remaining return r
returns total number of bytes in byte buffers containing data written
public boolean has errors return this errors size 0
checks if there are parsing errors
protected market data master get market data master return market data master
gets the market data master
public vertical spread get call spread return call spread
gets the call spread
public void set call spread vertical spread call spread this call spread call spread
sets the call spread
public position get lower strike leg position return lower strike leg position
gets the lower strike leg position
public void set lower strike leg position position lower strike leg position this lower strike leg position lower strike leg position
sets the lower strike leg position
public position get higher strike leg position return higher strike leg position
gets the higher strike leg position
public void set higher strike leg position position higher strike leg position this higher strike leg position higher strike leg position
sets the higher strike leg position
protected double get quote int index return quotes get index
gets the quote
public equity market data item get market data item return market data item
gets the market data item
public void write market data item market data item item throws cannot write market data item exception try if writer null file writer fw new file writer market data source true writer new csvwriter fw string line of market data item to csv split writer write next line of market data writer flush catch java io ioexception e throw new cannot write market data item exception e
write market data item
public string get host return get property feed descriptor constants host name
gets the host
public int get port string port get property feed descriptor constants port name if port null return integer value of port return 1
gets the port
public void set host string host put feed descriptor constants host name host
sets the host
public void set port int port put feed descriptor constants port name string value of port
sets the port
protected excelsior get excelsior return excelsior
gets the excelsior
protected event publisher get event publisher return publisher
gets the event publisher
public string get symbol return id get value
gets the symbol
public long get volume return volume
gets the volume
public double get wap return wap
gets the wap
public void set wap double wap this wap wap
sets the wap
protected interactive brokers market data master create market data master return interactive brokers market data master instance
creates the market data master
public order build market order market data item market data item side side int quantity time in force time in force boolean auto execute order order new order order m total quantity quantity order m action side name order m tif time in force name order m rule80 a i order m all or none true order m e trade only true order m order type mkt market order order m transmit auto execute return order
builds the market order
public order build limit order market data item market data item side side int quantity double price time in force time in force boolean auto execute order order build market order market data item side quantity time in force auto execute order m lmt price price order m order type lmt return order
builds the limit order
public trade status get trade status return trade status
gets the trade status
public void set contract contract contract this contract contract
sets the contract
public boolean is in control synchronized control chart return control chart is process in control
checks if is in control
public int get long ema days return long ema days
gets the long ema days
public void set long ema days int long ema days this long ema days long ema days
sets the long ema days
public int get short ema days return short ema days
gets the short ema days
public void set short ema days int short ema days this short ema days short ema days
sets the short ema days
private double get last short ema price string symbol ema quote last ema quote last ema quotes get symbol if last ema quote null return get close return last ema quote get short ema price
gets the last short ema price
private double get last long ema price string symbol ema quote last ema quote last ema quotes get symbol if last ema quote null return get close return last ema quote get long ema price
gets the last long ema price
private double get last ema return string symbol ema quote last ema quote last ema quotes get symbol if last ema quote null return get ema return return last ema quote get ema return
gets the last ema return
public double get long ema price return long ema price
gets the long ema price
public void set long ema price double price this long ema price price
sets the long ema price
public double get short ema price return short ema price
gets the short ema price
public void set short ema price double price this short ema price price
sets the short ema price
public double get ema return return ema return
gets the ema return
public void set ema return double ema return this ema return ema return
sets the ema return
protected double calculate ema return double last return double ema price double last ema price return moving average calculate ema return last return ema price last ema price
calculate ema return
public interactive brokers contract builder get contract builder for market data item market data item market data item interactive brokers contract builder builder null security type security type market data item get security type switch security type case equity builder new interactive brokers equity contract builder break case equity index builder new interactive brokers equity index contract builder break case equity option builder new interactive brokers equity option contract builder break return builder
gets the contract builder for market data item
public int get tick type return tick type
gets the tick type
private response int tick type this tick type tick type
instantiates a new response
public double get uema return uema
gets the uema
public void set uema double uema uema uema
sets the uema
public double get rsi index return rsi index
gets the rsi index
public void set rsi index double rsi index this rsi index rsi index
sets the rsi index
private double get last dema string symbol rsi ema quote quote current rsi ema quote get symbol double dema 0 0 if quote null dema quote get dema return dema
gets the last dema
private double get last uema string symbol rsi ema quote quote current rsi ema quote get symbol double uema 0 0 if quote null uema quote get uema return uema
gets the last uema
private double get last rsi index string symbol rsi ema quote quote current rsi ema quote get symbol if quote null return quote get rsi index return get rsi index
gets the last rsi index
public double get dema return dema
gets the dema
public void set dema double dema dema dema
sets the dema
private double get last close string symbol rsi ema quote last rsi ema quote current rsi ema quote get symbol if last rsi ema quote null return get close return last rsi ema quote get close
gets the last close
protected market data source get market data source string path excelsior get properties get property excelsior property keys historical data store name market data source source new market data source path return source
gets the market data source
protected interactive brokers handler get handler if handler null handler new interactive brokers handler this null null interactive brokers market data master instance return handler
gets the handler
protected void add ticker id to map int ticker id string symbol ticker map put ticker id symbol
adds the ticker id to map
protected string get ticker from map int ticker id return ticker map get ticker id
gets the ticker from map
public interactive brokers client get client return client
gets the client
public rsi ema quote factory get quote factory return quote factory
gets the quote factory
public string get ticker symbol for id int ticker id return get ticker from map ticker id
gets the ticker symbol for id
protected int increment quote counter string symbol integer count quote counter get symbol if count null count 1 quote counter put symbol count else quote counter put symbol count 1 return count
increment quote counter
protected void reset quote counter string symbol quote counter put symbol 0
reset quote counter
public boolean is log live data return log live data
checks if is log live data
public void get quote contract contract int ticker id get next req id add ticker id to map ticker id contract m symbol client req mkt data ticker id contract null true
gets the quote
protected int get quote counter string symbol integer count quote counter get symbol if count null count 0 return count
gets the quote counter
public int begin technical indicator stream contract contract collection technical indicator type request indicator types int req id get next req id add ticker id to map req id contract m symbol string buffer tick types new string buffer for technical indicator type request indicator type indicator types tick types append indicator type get tick type tick types append client req mkt data req id contract tick types to string false return req id
begin technical indicator stream
public interactive brokers market data master get market data master return market data master
gets the market data master
public interactive brokers portfolio manager get portfolio manager return portfolio manager
gets the portfolio manager
public excelsior identifier type get type return type
gets the type
public void set type excelsior identifier type type this type type
sets the type
public string get event feed name return get property feed descriptor constants event feed name name
gets the event feed name
public string get event feed package return get property feed descriptor constants event feed package name
gets the event feed package
public void set should run boolean should run this should run should run
sets the should run
public void tick snapshot end int arg0 todo auto generated method stub
tick snapshot end
public packet id get command return command
returns the command associated
public object get object int index if zipped unzip data if data null index 0 index data length return null return data index
returns the object at the specified index
public void unzip data if zipped return unzip try byte array input stream bais new byte array input stream byte data 0 gzipinput stream zis new gzipinput stream bais object input stream ois new object input stream zis data object ois read object ois close reset the flag zipped false catch ioexception ex system err println errror in packet java unzipping data system err println ex catch class not found exception ex todo catch class cast exception e todo system err println errror in packet unzip data data
undoes the results of zip data
public int get int value int index return integer get object index int value
returns the int value of the object at the specified index
public boolean get boolean value int index return boolean get object index boolean value
returns the boolean value of the object at the specified index
private string create motd string buffer buf new string buffer buf append welcome to team blood server is running version buf append version buf append build date if timestamp 0 l buf append new date timestamp to string else buf append unknown buf append return buf to string
make a default message o the day containing the version string and
public int size if zipped try return byte data 0 length catch class cast exception e todo system err println errror in packet size data return 0 else return 0
returns this packets approximate size in bytes if we happen to know
public void run logger info listening for clients thread current thread thread current thread while connector current thread try socket s server socket accept int id get free connection id logger info accepting connection id connections pending add element new connection this s id greeting id catch ioexception ex logger error error while connecting client
listen for incoming clients
public void die logger info shutting down kill thread accepting new connections connector null close socket try server socket close catch ioexception ex kill pending connnections for connection conn connections pending conn die connections pending remove all elements send kill commands to all connections n b i may be starting a race here for connection conn connections send conn get id new packet packet id packet close connection kill active connnections for connection conn connections conn die connections remove all elements connection ids clear
shuts down the server
public int get free connection id while get pending connection connection counter null get connection connection counter null connection counter return connection counter
returns a free connection id
public void die receiver null sender null try send queue clear socket close in close out close catch ioexception e logger error error closing connection catch null pointer exception ex never initialized poor thing
kill off the thread
public int get free game id while get server game game counter null game counter return game counter
returns a free game id
private void send from queue packet packet null try packet send queue take catch interrupted exception e return bytes sent send packet packet
waits for a packet to appear in the queue and then sends it
protected packet read packet try if in null in new object input stream socket get input stream packet packet packet in read object system out println server id command packet get command received return packet catch ioexception ex logger error io error reading command server disconnected this return null catch class not found exception ex logger error class not found error reading command server disconnected this return null
reads a complete net command from the given socket
private connection get pending connection int conn id for final connection conn connections pending if conn get id conn id return conn return null
returns a pending connection
protected int send packet packet packet int bytes 0 try if out null out new object output stream socket get output stream out flush out reset write each packet fresh out write object packet out flush bytes packet size int length 0 if packet get data null length packet get data length logger debug command packet get command sent with length data catch ioexception ex logger error error sending command dropping player logger error ex logger error ex get message server disconnected this return bytes
sends a packet
public connection get connection int conn id return connection ids get conn id
returns a connection indexed by id
public void disconnected connection conn write something in the log logger info connection conn get id disconnected check if connection was involved in a game int conn id conn get id server game server game get server game for connection conn id if server game null abort the game and remove it from the list server game abort hosted games remove server game kill the connection and remove it from any lists it might be on conn die connections remove element conn connections pending remove element conn connection ids remove new integer conn get id
called when it is sensed that a connection has terminated
private void greeting int conn id logger debug sending greeting to connection conn id send server greeting client should reply with client info send to pending conn id new packet packet id packet server greeting
sent when a clients attempts to connect
private void send packet packet if connections null return packet zip data for connection conn connections conn send packet
send a packet to all connected clients
public void connect throws unknown host exception ioexception socket new socket host port pump new thread this pump start
attempt to connect to the specified host
public void send int conn id packet packet packet zip data get connection conn id send packet
send a packet to a specific connection
public void die if we re still connected tell the server that we re going down if connected send new packet packet id packet close connection connected false pump null shut down threads sockets try socket close in close out close catch ioexception e e print stack trace catch null pointer exception e not a big deal just never connected system out println client died notify listeners for client listener l client listeners l disconnected
shuts down threads and sockets
private void send to pending int conn id packet packet get pending connection conn id send packet
send a packet to a pending connection