This repository has been archived by the owner on Feb 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1478dc8
commit cc15df2
Showing
9 changed files
with
68 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
import json | ||
|
||
import scrapy | ||
|
||
from coinincome.items import CoinincomeItem | ||
|
||
|
||
class AntpoolSpider(scrapy.Spider): | ||
name = 'antpool' | ||
allowed_domains = ['antpool.com'] | ||
start_urls = ['http://antpool.com/'] | ||
start_urls = [ | ||
'https://v3.antpool.com/auth/v3/index/coinList', | ||
'https://v3.antpool.com/lab/poolcoins' | ||
] | ||
|
||
def parse(self, response): | ||
pass | ||
response_body = json.loads(response.body) | ||
if response_body['code'] == "000000": | ||
for coin in response_body['data']['items']: | ||
item = CoinincomeItem() | ||
item['coin'] = coin['coinType'].lower() | ||
# pps 收益 = 1t * 86400 / D / Coefficient * blockReward | ||
item['income_coin'] = coin['calculateUnit'] * 86400 / coin['networkDiff'] * coin['blockReward'] / coin[ | ||
'coinCoefficient'] | ||
item['income_hashrate_unit'] = self.calculate_unit(coin['calculateUnit']) | ||
item['next_income_coin'] = 0 | ||
item['pool_name'] = self.name | ||
item['request_url'] = response.url | ||
yield item | ||
|
||
def calculate_unit(self, share): | ||
units = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"] | ||
index = 0 | ||
while share >= 1000: | ||
share = share / 1000 | ||
index = index + 1 | ||
return units[index] |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pymysql |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
cd coinincome | ||
scrapy runspider spiders/btccom.py | ||
scrapy runspider spiders/poolin.py | ||
scrapy runspider spiders/huobipool.py | ||
scrapy runspider spiders/antpool.py | ||
scrapy runspider spiders/sparkpool.py |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
project: 409348 | ||
requirements: | ||
file: requirements.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Automatically created by: shub deploy | ||
|
||
from setuptools import setup, find_packages | ||
|
||
setup( | ||
name = 'project', | ||
version = '1.0', | ||
packages = find_packages(), | ||
entry_points = {'scrapy': ['settings = coinincome.settings']}, | ||
) |