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)
@lockefox
lockefox / PROSPER_CREST_markethistory.r
Last active July 1, 2016 19:13
Single Item CREST market history extraction - Like @EVEprosper
packages.list <- c("data.table",
"quantmod",
"jsonlite")
packages.new <- packages.list[!(packages.list %in% installed.packages()[,"Package"])]
if(length(packages.new)){
install.packages(packages.new)
}
library(data.table)
library(quantmod)
library(jsonlite)
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)
library(RODBC)
library(ggplot2)
library(grid)
library(reshape)
library(scales)
library(data.table)
library(quantmod)
library(jsonlite)
library(cowplot)