In [1]:
#pip install eveapi
import eveapi
In [2]:
#These are account / character specific. You need to activate an API with
#the relevant permissions for this to work.
YOUR_KEYID = 4598442
YOUR_VCODE = "RsMTXAayByfitNWtOiOGdwRhSoJnd55f1CeURpUMZIwYgr8JZGkslqmxzrBXeHsi"
charID = '799404375'
In [3]:
api = eveapi.EVEAPIConnection()
cachedApi = eveapi.EVEAPIConnection()
me = cachedApi.auth(keyID=YOUR_KEYID, vCode=YOUR_VCODE).character(charID)
wallet = me.WalletTransactions()
walletTx = wallet.transactions
contracts = me.contracts()
contractTx = contracts.contractList
In [4]:
#List most recent transactions
for i in walletTx[:10]:
print ' - '.join([i.transactionType, i.typeName, str(i.quantity), str(i.price), i.stationName])
In [5]:
def profits(item):
print item
cost, proceeds, quantity, taxes = 0,0,0,0
for i in walletTx:
if i.typeName == item:
if i.transactionType == 'buy':
quantity = quantity + i.quantity
cost = cost + i.quantity * i.price
if i.transactionType =='sell':
proceeds = proceeds + i.quantity * i.price
quantity = quantity - i.quantity
taxes = taxes + i.quantity * i.price * 0.009 #this was my net transaction rate.
print ' - '.join([i.transactionType, i.typeName, str(i.quantity), str(i.price), i.stationName])
print "Proceeds = {:,}".format(proceeds)
print "Cost = {:,}".format(cost)
print "Taxes = {:,}".format(taxes)
print "Profit = {:,}".format(proceeds-cost-taxes)
print "Remaining Quantity = {:,}".format(quantity)
print
#Change items you want to get profits for here.
items = ['Liquid Ozone', 'Paladin']
for item in items:
profits(item)
In [6]:
#List outstanding contracts
for i, v in enumerate(contractTx,1):
if v.status =='Outstanding':
print i, v.status, v.type, v.title, v.reward, v.price
In [7]:
#List completed contracts
for i, v in enumerate(sorted(contractTx, key=lambda v:v.dateCompleted, reverse=True),1):
if v.status =='Completed':
print i, v.dateCompleted, v.status, v.type, v.title, v.reward, v.price