Sunday, May 11, 2014

Rough draft of the exchange software (works for anything)

            //selling IBM
            TransactionItem item = Transaction.Sell("100 IBM", "myCommerceID");
            TransactionItem terms = Transaction.Terms(item.TransactionID, "5000 USD", "myCommerceID");

            item = Transaction.CorrespondingValue(item.TransactionID, "4900 USD", "hisCommerceID");

            item.Accepted();  //becomes a contract here

            TransactionItem deliverStock = Transaction.Delivered(item.TransactionID, "100 IBM", "myCommerceID");
            TransactionItem deliverCash = Transaction.Delivered(item.TransactionID, "4900 USD", "hisCommerceID");

            Transaction.Completed(item.TransactionID, "complete", "myCommerceID");
            Transaction.Completed(item.TransactionID, "complete", "hisCommerceID");

            //buying IBM
            TransactionItem item2 = Transaction.Sell("5000 USD", "myCommerceID");
            TransactionItem terms2 = Transaction.Terms(item2.TransactionID, "100 IBM", "myCommerceID");

            item2 = Transaction.CorrespondingValue(item2.TransactionID, "100 IBM", "hisCommerceID");
            item2 = Transaction.Modify(item2.TransactionID, "5100 USD", "hisCommerceID");

            item2.Accepted();


Database:


1 faeb6594-ca25-494c-b506-2b8cc76f06fb myCommerceID Initiating Value 100 IBM 2014-05-11 15:23:50.493 NULL
2 faeb6594-ca25-494c-b506-2b8cc76f06fb myCommerceID Terms 5000 USD 2014-05-11 15:23:53.813 NULL
3 faeb6594-ca25-494c-b506-2b8cc76f06fb hisCommerceID Value 4900 USD 2014-05-11 15:23:53.833 2014-05-11 15:23:53.847
4 faeb6594-ca25-494c-b506-2b8cc76f06fb myCommerceID Delivery 100 IBM 2014-05-11 15:23:53.853 NULL
5 faeb6594-ca25-494c-b506-2b8cc76f06fb hisCommerceID Delivery 4900 USD 2014-05-11 15:23:53.860 NULL
6 faeb6594-ca25-494c-b506-2b8cc76f06fb myCommerceID Completed complete 2014-05-11 15:23:53.867 2014-05-11 15:23:53.867
7 faeb6594-ca25-494c-b506-2b8cc76f06fb hisCommerceID Completed complete 2014-05-11 15:23:53.873 2014-05-11 15:23:53.873
8 24370bb9-ac0c-4546-bcd7-dd131f5f7aa4 myCommerceID Initiating Value 5000 USD 2014-05-11 15:23:53.880 NULL
9 24370bb9-ac0c-4546-bcd7-dd131f5f7aa4 myCommerceID Terms 100 IBM 2014-05-11 15:23:53.883 NULL
10 24370bb9-ac0c-4546-bcd7-dd131f5f7aa4 hisCommerceID Value 100 IBM 2014-05-11 15:23:53.887 NULL
11 24370bb9-ac0c-4546-bcd7-dd131f5f7aa4 hisCommerceID Modification 5100 USD 2014-05-11 15:23:53.893 2014-05-11 15:23:53.900


No comments:

Post a Comment

Newer Post FOR MORE, CLICK OLDER POSTS ----> Older Post