Posted 25 May 2013 - 11:23 PM
CCStock / CConomy
Stocks and Economy
I have created a program that allows you to trade stocks and manage money in ComputerCraft
Features:
- Account System
- Money (paying other people or buying stocks (which leads us to…))
- Buying/Selling stocks
- Fancy GUI
Spoiler
Login Screen:Portfolio: (Note: I raised the starting amount of money from when I took this picture)
Searching for a stock:
Stock details/Buying & Selling:
After buying the stock:
Sell page:
for the record, I couldn't figure out how to take screenshots in ccdesk
Download:
pastebin get LJs3zGBm stock
Web API:
Spoiler
For stock prices and searching, I used http://dev.markitondemand.com/The rest of the api is on
imgood.hostoi.com
Verify Username/Password:
imgood.hostoi.com/user/login.php?name=<USERNAME>&pass=<PASSWORD>
Check Balance:
imgood.hostoi.com/user/balance.php?name=<USERNAME>
List Stocks:
imgood.hostoi.com/user/stocks.php?name=<USERNAME>
Note: This returns a JSON table. You'll need another API to decode itTransfer Money:
imgood.hostoi.com/user/transfer.php?from=<USERNAME>&pass=<PASSWORD>&to=<OTHERNAME>&amount=<AMOUNT>
from and pass must be a valid accountto has to be a valid username
amount can not be negative and it can not be more than you have
Buy Stock:
imgood.hostoi.com/stock/buy.php?name=<USERNAME>&pass=<PASSWORD>&symbol=<STOCKSYMBOL>&amount=<AMOUNT>
symbol is a stock's ticker symbolamount is the amount of shares to buy
Sell Stock:
imgood.hostoi.com/stock/sell.php?name=<USERNAME>&pass=<PASSWORD>&symbol=<STOCKSYMBOL>&amount=<AMOUNT>
symbol is a stock's ticker symbolamount is the amount of shares to buy