AlgoTraderAlgoTrader Documentation
algotrader/core/src/main/scripts/db/mysql
MySql scripts
create-fix-messagestore.sql
creates database
tables uses for Fix message persistence
datetime_milli_precision.sql
converts all
datetime
fields to usage of millisecond
(requires MySql 5.6.4)
reset-db.sql
reset script which resets the
tables cash_balance, order, portfolio_value, subscription,
transaction and position.
Using Spring Transaction Boundaries are declared on Services using the annotation
@Transactional
. Transaction Boundaries are handled by the
org.springframework.transaction.interceptor.TransactionInterceptor
.
A typical declaration looks like
this:
@Transactional(propagation = Propagation.SUPPORTS)
public class TransactionServiceImpl implements TransactionService {
@Transactional(propagation = Propagation.REQUIRED)
public void saveTransaction(final Transaction transaction) {
...
}
...
}
In order for transactions to work services need to implement an interface (e.g.
TransactionServiceImpl
implements
TransactionService
).
Transaction demarcation only works when a service method is called from another service with dependencies properly injected through Spring. For example using a scheduler inside a service to then call methods with itself will not create transactions.