Skip to content

Instantly share code, notes, and snippets.

@lockefox
lockefox / snapshot_evecentral.sql
Last active August 29, 2015 14:13
Table for eve_central snapshots
DROP TABLE IF EXISTS `snapshot_evecentral`;
CREATE TABLE `snapshot_evecentral` (
`price_date` DATE NOT NULL,
`price_time` TIME NOT NULL,
`typeid` INT(8) NOT NULL,
`locationid` INT(8) NOT NULL,
`location_type` ENUM('solarsystemid','stationid','regionid','global') NULL,
`buy_sell` TINYINT(1) NOT NULL DEFAULT 0, -- 0=sell, 1=buy
`price_best` FLOAT(13,2) NULL, -- BUY_MAX, SELL_MIN
`price_avg` FLOAT(13,2) NULL,
@lockefox
lockefox / ec_spread_graph
Last active August 29, 2015 14:16
Graphing profile for generating http://i.imgur.com/a7KWfxb.png
library(RODBC)
library(ggplot2)
library(grid)
market_data <- read.csv("--FILEPATH GOES HERE--", header=TRUE)
market_data$date <- as.Date(market_data$date)
market_data$typeid <- as.factor(market_data$typeid)
market_data$hour <- as.factor(market_data$HOUR.hour)
market_data$locationid <- as.factor(market_data$locationid)
library(RODBC)
library(jsonlite)
library(data.table)
library(grid)
library(reshape)
library(ggplot2)
library(sde)
library(zoo)
library(plyr)
library(RODBC)
library(jsonlite)
library(data.table)
library(grid)
library(reshape)
library(ggplot2)
library(sde)
library(zoo)
library(plyr)
#### INCLUDE LIBRARIES ####
library(quantmod) #getSymbols/chartSeries
library(zoo) #rollmean/rollapply
library(plyr)
library(sde) #GBM()
library(ggplot2) #ggplot()
library(reshape) #melt()
#### SCRIPT GLOBALS ####
StockSymbol <- "MU"
UPDATE invTypes SET volume=500 WHERE groupID in (29,1022,31);
UPDATE invTypes SET volume=1000 WHERE groupID in (448,12,649,952,340);
UPDATE invTypes SET volume=2500 WHERE groupID in (324,830,893,25,831,237,834);
UPDATE invTypes SET volume=3750 WHERE groupID in (543,463);
UPDATE invTypes SET volume=5000 WHERE groupID in (420,541,963);
UPDATE invTypes SET volume=10000 WHERE groupID in (906,358,833,894,832,26);
UPDATE invTypes SET volume=15000 WHERE groupID in (1201,419,540);
UPDATE invTypes SET volume=50000 WHERE groupID in (27,898,381,941,900);
UPDATE invTypes SET volume=20000 WHERE groupID in (1202,380,28);
UPDATE invTypes SET volume=1000000 WHERE groupID in (883,547,485,513,902,659);
@lockefox
lockefox / shipFitting_query.sql
Created September 5, 2015 02:56
A query for selecting ships/fittings info for typeid lookup
SELECT conv.typeName as `typeName`, conv.typeID as `typeID`, COALESCE(dgm.valueInt, dgm.valueFloat,0) as `meta`, conv.groupID,
IF(conv.groupID in (29,1022,31), 500,
IF(conv.groupID in (448,12,649,952,340), 1000,
IF(conv.groupID in (324,830,893,25,831,237,834), 2500,
IF(conv.groupID in (543,463), 3750,
IF(conv.groupID in (420,541,963), 5000,
IF(conv.groupID in (906,358,833,894,832,26), 10000,
IF(conv.groupID in (1201,419,540), 15000,
IF(conv.groupID in (27,898,381,941,900), 50000,
IF(conv.groupID in (1202,380,28), 20000,
@lockefox
lockefox / PLEX_predictor.r
Created September 21, 2015 00:05
Prediction script for 2015-Q4 PLEX prices in EVE Online
#### INCLUDE LIBRARIES ####
library(quantmod) #getSymbols/chartSeries
library(zoo) #rollmean/rollapply
library(plyr)
library(sde) #GBM()
library(ggplot2) #ggplot()
library(reshape) #melt()
library(TTR) #RSI()
library(grid)
@lockefox
lockefox / angel_npc-kill_price-stats_raw.csv
Created February 4, 2016 16:28
Raw Angel_NPC-KILL and CREST price data, EVE Online
Date Cynabal Dramiel Machariel SUM_factionKills mean
2016-01-12 166254000 48290500 447648000 721379 2.207308e+08
2016-01-13 165430000 46586700 449224000 831691 2.204136e+08
2016-01-14 165570000 46734000 456961000 787412 2.230883e+08
2016-01-15 161172000 47407600 451482000 788098 2.200205e+08
2016-01-16 164873000 47727500 447546000 876720 2.200488e+08
2016-01-17 165724000 47626700 448990000 857619 2.207802e+08
2016-01-18 165303000 48373500 445440000 789442 2.197055e+08
2016-01-19 166448000 45800300 442759000 743316 2.183358e+08
2016-01-20 174764000 48519400 439389000 790141 2.208908e+08
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 25 columns, instead of 14. in line 5.
Date,Cynabal,Dramiel,Machariel,SUM_factionKills,mean,log_activity,ln_activity,sqrt_activity,activity_shift1,activity_shift2,activity_shift3,activity_shift4,activity_shift5,ln-activity_shift1,ln-activity_shift2,ln-activity_shift3,ln-activity_shift4,ln-activity_shift5,5d_movingAvg_cyn,5d_deviation_cyn,5d_movingAvg_dram,5d_deviation_dram,5d_movingAvg_mach,5d_deviation_mach
1/12/2016,166254000,48290500,447648000,721379,220730800,5.858163495,13.48891994,849.3403323,,,,,,,,,,,,,,,,
1/13/2016,165430000,46586700,449224000,831691,220413600,5.919962002,13.63121626,911.9709425,721379,,,,,13.48891994,,,,,,,,,,
1/14/2016,165570000,46734000,456961000,787412,223088300,5.896202029,13.5765069,887.3623837,831691,721379,,,,13.63121626,13.48891994,,,,,,,,,
1/15/2016,161172000,47407600,451482000,788098,220020500,5.896580225,13.57737773,887.7488384,787412,831691,721379,,,13.5765069,13.63121626,13.48891994,,,,,,,,
1/16/2016,164873000,47727500,447546000,876720,220048800,5.942860914,13.68394295,936.333274,788098,787412,831691,721379,