This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'set' | |
exs = Hash.new | |
open("exchlist.txt").each do |line| | |
next if line[0] == '0' | |
exl = line.chomp.split("\t") | |
exs["#{exl[1]}.#{exl[2]}"] = exl[3] | |
end | |
blps = Set.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'set' | |
# source format is | |
# +----------+------------+-----------+ | |
# | MarketID | ExchangeID | SedolCode | | |
# +----------+------------+-----------+ | |
# | caequ | XTSX | 2000075 | | |
# | clequ | XSGO | 2000257 | | |
# | |
# Output format is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "win32ole" | |
class ExcelUtil | |
def [] x, y | |
@xl.ActiveSheet.Cells.Item(y,x) | |
end | |
def initialize | |
@xl = nil | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cdt = Time.now().strftime('%H%M%S') | |
a = File.expand_path(File.dirname(__FILE__)) | |
open("#{a}/out.#{cdt}", 'w') do |f| | |
f.puts(cdt) | |
f.puts(a) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'zipruby' | |
require 'win32ole' | |
require 'pp' | |
sedols = Array::new() | |
# Read sedols | |
open("sedols.txt").each do |l| | |
# sedols.txt has below like contents |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'zipruby' | |
require 'pp' | |
Dir.glob('*.zip') do |zipfile| | |
userid = zipfile.sub(/.*-(\w{5,8})-.*/,'\1') | |
Zip::Archive.open(zipfile) do |arcs| | |
arcs.each do |f| | |
next unless f.name == 'SOME_SPECIAL.xml' | |
puts f.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h = Hash.new | |
def addHash(jiraId, h) | |
if h.has_key? jiraId | |
h[jiraId] = h[jiraId] + 1 | |
else | |
h[jiraId] = 1 | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i = 0 | |
open(ARGV[0]).each do |l| | |
next if l.index("#") | |
dest_name = "XXXX_" + Time.now.strftime("%Y%m%d_%H%M%S") + format("_%06d_1.csv", i) | |
open(dest_name, "w").puts l | |
i += 1 | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:%s/\(.\{80}\)/\1\r/g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "set" | |
excs = Set::new() | |
open("Subscription.log").each do |l| | |
# l = 2013-01-25 20:01:04,661 [ Main] INFO InstrumentList::AddInstrumentRequest: (26A32E58)4286679 CP Equity subscribed... | |
pos = l.index("Equity subscribed") | |
next unless pos | |
exch = l[pos - 5, 4] | |
exch = exch[2,2] if exch[1] == 32 |