Welcome Guest, Not a member yet? Register   Sign In
any one interest in foreign-exchange system?
#1

[eluser]chmod[/eluser]
I have the whole source code which are written by JAVA for a foreign-exchange(named FX).
Any one interest in it?
This system can be used trade fx online. Because this system is more complex , so need a BIG financial group to transport it ,and fx-trading is not allowed by government in China.

this is a part of code:

package com.livedoor.fx.confirmation;

import java.io.File;
import java.io.FileWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import net.sf.hibernate.Session;
import net.sf.hibernate.Transaction;

import com.chinafxj.bf.account.AccountException;
import com.chinafxj.bf.cpdispatch.common.Helpers;
import com.chinafxj.bf.cpdispatch.timequoteorder.TimeQuoteOrder;
import com.chinafxj.bf.dal.ContractDal;
import com.chinafxj.bf.dal.CpDal;
import com.chinafxj.bf.dal.OrderDal;
import com.chinafxj.bf.dal.ProductDal;
import com.chinafxj.bf.dal.bean.db2.FxContract;
import com.chinafxj.bf.dal.bean.db2.FxCpExecution;
import com.chinafxj.bf.dal.bean.db2.FxLeverageGroup;
import com.chinafxj.bf.dal.bean.db2.FxOrder;
import com.chinafxj.bf.dal.factory.DB2SessionFactory;
import com.chinafxj.bf.models.bean.LeverageGroupInfo;
import com.chinafxj.bf.models.bean.OrderBindInfo;
import com.chinafxj.bf.models.enum.BoolEnum;
import com.chinafxj.bf.models.enum.CpTradeStatusEnum;
import com.chinafxj.bf.models.enum.CpTradeTypeEnum;
import com.chinafxj.bf.models.enum.SideEnum;
import com.chinafxj.bf.models.exception.ServiceException;
import com.chinafxj.bf.product.ProductService;
import com.chinafxj.util.Logit;


public class CreateMT300Processor {
// For logging
private static final Logit m_log = Logit.getInstance(CreateMT300Processor.class);
private static final String TAB = "\t";
private static final String ENTER = "\n";
private static final String COMMA = ",";
private static final String DOT = ".";
// private static final String KeyLinkID = "LIVECN01";
private static final String KeyLinkID = "LIVEJP01";
private static final String receiveAgent = "UBSWJPJT";



public void writeMT300Text(List obi) {
if (obi == null) {
return ;
}

writeFxCpExecutionLog(obi);

try {
String filetemp = "";
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
filetemp = formatter.format(new Date());
String MT300_TEXT_PATH ="" ;
String MT300_TEXT_FILENAME = filetemp + ".txt" ;
File mt300_File =null;
FileWriter mt300_writer=null ;
// get the text file name and path from config file mt300.properties
// the key is :MT300_TEXT_PATH ,
// if is null or blank then use the default value .
try {
String CP_PROPERTIES_FILE = "mt300.properties";
String MT300_TEXT_PATH_KEY ="MT300_TEXT_PATH" ;
MT300_TEXT_PATH = Helpers.getProperties(CP_PROPERTIES_FILE).getProperty(MT300_TEXT_PATH_KEY);

if (MT300_TEXT_PATH ==null ||MT300_TEXT_PATH.trim().equals("")) {
// MT300_TEXT_PATH ="D:\\logs" ;
// MT300_TEXT_PATH ="/opt/ubs/mt300" ;
MT300_TEXT_PATH ="/home/sc/UBS_SC/outgoing/KLTPImport/outbox" ;
}

} catch (Exception e) {
// MT300_TEXT_PATH ="D:\\logs" ;
// MT300_TEXT_PATH ="/opt/ubs/mt300" ;
MT300_TEXT_PATH ="/home/sc/UBS_SC/outgoing/KLTPImport/outbox" ;
m_log.error("Error in get Properties ",e);
}
//begin to write text to file .
m_log.debug("writeMT300Text : get Properties MT300_TEXT_PATH = " + MT300_TEXT_PATH + ", MT300_TEXT_FILENAME = " + MT300_TEXT_FILENAME);
try{
mt300_File =new File(MT300_TEXT_PATH,MT300_TEXT_FILENAME);
mt300_File.createNewFile();
mt300_writer = new FileWriter(mt300_File,true);
mt300_writer.write(getMT300Message(obi));
mt300_writer.flush();
mt300_writer.close();

} catch (Exception e){
m_log.error("Error in write infomation",e);
}

} catch (Exception E) {
m_log.error("Error timeout infomation",E);
}
}


private void writeFxCpExecutionLog(List obi) {
// TODO Auto-generated method stub
if (obi == null) {
return ;
}
for(int i = 0 ; i < obi.size() ; i++) {
FxCpExecution fxCpExecution = (FxCpExecution)obi.get(i);
m_log.debug(fxCpExecution.toString());
}


}

public List getCpExecutionListForUBS() {
return CpDal.getInstance().getCpExecutionList("UBS",CpTradeStatusEnum.TRADED, CpTradeTypeEnum.SPOT);
}


public void updateCpExecutionListForUBS(List obi) throws Exception{

if (obi == null) {
return ;
}
Transaction tx = null;
m_log.debug("updateCpExecutionListForUBS(List obi) function start");
try {
DB2SessionFactory.start();
Session sess = DB2SessionFactory.currentSession();
tx = sess.beginTransaction();
#2

[eluser]Daniel H[/eluser]
How random, posting some UBS fx application code on a public forum...?!




Theme © iAndrew 2016 - Forum software by © MyBB